views:

465

answers:

3

Hi Everyone

I'm using Netbeans and I want to grab the latest hibernate artifact from the jboss maven repository.

I have added the repository in netbeans, and I can navigate to it within the repository browser.

After I add this dependency to my pom.xml file and attempt to build my project, I get an error saying that the artifact could not be downloaded and i should attempt to do so manually.

From the output, it appears that it is only trying to download from the default central repository, and not the new repository i have added.

How I make it so that netbeans downloads the artifact I need from the jboss repository?

==== maven output ====

Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate/3.5.0.Beta-1/hibernate-3.5.0.Beta-1.pom Unable to find resource 'org.hibernate:hibernate:pom:3.5.0.Beta-1' in repository central (http://repo1.maven.org/maven2) Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate/3.5.0.Beta-1/hibernate-3.5.0.Beta-1.pom

Unable to find resource 'org.hibernate:hibernate:pom:3.5.0.Beta-1' in repository central (http://repo1.maven.org/maven2)

[ERROR]BUILD ERROR

Failed to resolve artifact.

Missing:

1) org.hibernate:hibernate:pom:3.5.0.Beta-1 Path to dependency: 1) com.noisyair:wisi:war:0.0.1-SNAPSHOT 2) org.hibernate:hibernate:pom:3.5.0.Beta-1


1 required artifact is missing.

for artifact: com.noisyair:wisi:war:0.0.1-SNAPSHOT

from the specified remote repositories: central (http://repo1.maven.org/maven2)

+1  A: 

By "added the respoitory in netbeans" you mean that you added the repository for the repository browser? Then check that that repository is also declared in your pom file.

axtavt
+2  A: 

Adding the JBoss repository in NetBeans is one thing but this won't make the content of this repository available to Maven projects. To do so, you need to add the JBoss Maven repository to the pom.xml of your project. Actually, the error you get has nothing to do with NetBeans, it is a pure Maven "issue".

To fix it, provide the following configuration:

<project>
  ...
  <repositories>
    <repository>
      <id>repository.jboss.org</id>
      <url>http://repository.jboss.org/maven2&lt;/url&gt;
    </repository>
    ...
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>3.5.0-Beta-2</version>
    </dependency>
    ...
  </dependencies>
  ...
</project>

And Hibernate's jar will get downloaded successfully from the JBoss repository.

Pascal Thivent
perfect. Thanks!
darren
A: 

Netbeans 6.8 has really great maven support , for maven best practices see MavenBestPractices ,There is a section called Utilizing and managing Maven repositories that show you how to add repositories to Netbeans , but as previously said you need to add repository to POM that has your artifacts.

Mite Mitreski