简体   繁体   中英

Netbeans won't download Maven artifact

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 )

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</url>
    </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.

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.

Netbeans 6.8确实具有强大的Maven支持,有关Maven最佳实践的信息,请参见MavenBestPractices 。有一个名为“ 使用和管理Maven存储库”的部分 ,向您展示如何向Netbeans添加存储库,但是如前所述,您需要向具有工件的POM添加存储库。 。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM