eclipse Maven2:缺少工件但罐子到位
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6111408/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven2: Missing artifact but jars are in place
提问by Jannick
From now to then, my Maven 2 started to mess around.
从现在到那时,我的 Maven 2 开始乱七八糟。
I am using SPring STS 2.6.1 and have a single project based on Spring 3, Hibernate, DWR, Cometd and all that stuff.
我使用的是 Spring STS 2.6.1 并且有一个基于 Spring 3、Hibernate、DWR、Cometd 和所有这些东西的项目。
Today I just updated from Git und all of a sudden, I got that scary mvn
exclamation mark (!) next to my project.
今天我刚刚从 Git 更新,突然间,mvn
我的项目旁边出现了那个可怕的感叹号 (!)。
After hitting "Project -> Maven -> Update dependencies" I just receive:
点击“项目 -> Maven -> 更新依赖项”后,我刚刚收到:
24.05.11 15:26:58 MESZ: Missing artifact org.jdom:jdom:jar:1.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-common:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-core:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-solrj:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact stax:stax:jar:1.2.0:compile
24.05.11 15:26:58 MESZ: Missing artifact stax:stax-api:jar:1.0.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-lucene-analyzers:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-lucene-core:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-lucene-highlighter:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-lucene-queries:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-lucene-snowball:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-lucene-spellchecker:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-httpclient:commons-httpclient:jar:3.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.commons:commons-io:jar:1.3.2:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-logging:commons-logging:jar:1.0.4:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.solr:solr-commons-csv:jar:1.3.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
24.05.11 15:26:58 MESZ: Missing artifact net.java.dev.stax-utils:stax-utils:jar:20040917:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.lucene:lucene-snowball:jar:2.4.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.lucene:lucene-core:jar:2.4.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.slf4j:slf4j-api:jar:1.6.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-core:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact aopalliance:aopalliance:jar:1.0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-aspects:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-test:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-context:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-context-support:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-tx:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-jdbc:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-orm:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-oxm:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-web:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework:spring-instrument:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework.security:spring-security-core:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework.security:spring-security-web:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework.security:spring-security-taglibs:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework.security:spring-security-acl:jar:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework.security:spring-security-parent:pom:3.0.5.RELEASE:compile
24.05.11 15:26:58 MESZ: Missing artifact org.springframework.security:spring-security-config:jar:3.0.5.RELEASE:system
24.05.11 15:26:58 MESZ: Missing artifact org.hibernate:hibernate-core:jar:3.3.2.GA:compile
24.05.11 15:26:58 MESZ: Missing artifact antlr:antlr:jar:2.7.6:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-collections:commons-collections:jar:3.1:compile
24.05.11 15:26:58 MESZ: Missing artifact dom4j:dom4j:jar:1.6.1:compile
24.05.11 15:26:58 MESZ: Missing artifact javax.transaction:jta:jar:1.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile
24.05.11 15:26:58 MESZ: Missing artifact org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile
24.05.11 15:26:58 MESZ: Missing artifact org.hibernate:hibernate-commons-annotations:jar:3.1.0.GA:compile
24.05.11 15:26:58 MESZ: Missing artifact org.hibernate:ejb3-persistence:pom:1.0.2.GA:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-dbcp:commons-dbcp:jar:1.4:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-pool:commons-pool:jar:1.5.4:compile
24.05.11 15:26:58 MESZ: Missing artifact org.aspectj:aspectjweaver:jar:1.6.10:compile
24.05.11 15:26:58 MESZ: Missing artifact org.slf4j:slf4j-log4j12:jar:1.6.1:compile
24.05.11 15:26:58 MESZ: Missing artifact log4j:log4j:jar:1.2.16:compile
24.05.11 15:26:58 MESZ: Missing artifact javax.persistence:persistence-api:jar:1.0:compile
24.05.11 15:26:58 MESZ: Missing artifact javassist:javassist:jar:3.12.1.GA:compile
24.05.11 15:26:58 MESZ: Missing artifact postgresql:postgresql:jar:9.0-801.jdbc4:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-codec:commons-codec:jar:1.4:compile
24.05.11 15:26:58 MESZ: Missing artifact org.directwebremoting:dwr:jar:2.0.3:compile
24.05.11 15:26:58 MESZ: Missing artifact org.beanshell:bsh:jar:2.0b4:compile
24.05.11 15:26:58 MESZ: Missing artifact org.jasypt:jasypt:jar:1.7:compile
24.05.11 15:26:58 MESZ: Missing artifact cglib:cglib:jar:2.2:compile
24.05.11 15:26:58 MESZ: Missing artifact asm:asm:jar:3.1:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-fileupload:commons-fileupload:jar:1.2.2:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.poi:poi:jar:3.8-beta1:compile
24.05.11 15:26:58 MESZ: Missing artifact jasperreports:jasperreports:jar:3.5.3:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-beanutils:commons-beanutils:jar:1.8.0:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-digester:commons-digester:jar:1.7:compile
24.05.11 15:26:58 MESZ: Missing artifact jfree:jcommon:jar:1.0.15:compile
24.05.11 15:26:58 MESZ: Missing artifact jfree:jfreechart:jar:1.0.12:compile
24.05.11 15:26:58 MESZ: Missing artifact xml-apis:xml-apis:jar:1.3.02:compile
24.05.11 15:26:58 MESZ: Missing artifact eclipse:jdtcore:jar:3.1.0:compile
24.05.11 15:26:58 MESZ: Missing artifact junit:junit:jar:4.8.2:test
24.05.11 15:26:58 MESZ: Missing artifact org.easymock:easymock:jar:3.0:test
24.05.11 15:26:58 MESZ: Missing artifact cglib:cglib-nodep:jar:2.2:test
24.05.11 15:26:58 MESZ: Missing artifact org.objenesis:objenesis:jar:1.2:test
24.05.11 15:26:58 MESZ: Missing artifact net.sf.ehcache:ehcache:pom:2.3.1:compile
24.05.11 15:26:58 MESZ: Missing artifact net.sf.ehcache:ehcache-core:jar:2.3.1:compile
24.05.11 15:26:58 MESZ: Missing artifact net.sf.ehcache:ehcache-terracotta:jar:2.3.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.opensymphony.quartz:quartz-all:jar:1.6.1:compile
24.05.11 15:26:58 MESZ: Missing artifact javax.servlet:jstl:jar:1.1.2:compile
24.05.11 15:26:58 MESZ: Missing artifact taglibs:standard:jar:1.1.2:compile
24.05.11 15:26:58 MESZ: Missing artifact org.aspectj:aspectjrt:jar:1.6.5:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.velocity:velocity:jar:1.6.2:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-lang:commons-lang:jar:2.4:compile
24.05.11 15:26:58 MESZ: Missing artifact oro:oro:jar:2.0.8:compile
24.05.11 15:26:58 MESZ: Missing artifact javax.mail:mail:jar:1.4.1:compile
24.05.11 15:26:58 MESZ: Missing artifact javax.activation:activation:jar:1.1:compile
24.05.11 15:26:58 MESZ: Missing artifact com.lowagie:itext:jar:2.0.7:compile
24.05.11 15:26:58 MESZ: Missing artifact bouncycastle:bcmail-jdk14:jar:138:compile
24.05.11 15:26:58 MESZ: Missing artifact bouncycastle:bcprov-jdk14:jar:138:compile
24.05.11 15:26:58 MESZ: Missing artifact org.cometd.java:cometd-java-server:jar:1.0.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.cometd.java:cometd-api:jar:1.0.1:compile
24.05.11 15:26:58 MESZ: Missing artifact org.eclipse.jetty:jetty-util:jar:7.0.1.v20091125:compile
24.05.11 15:26:58 MESZ: Missing artifact org.eclipse.jetty:jetty-continuation:jar:7.0.1.v20091125:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.velocity:velocity-tools:jar:2.0:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-chain:commons-chain:jar:1.1:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-validator:commons-validator:jar:1.3.1:compile
24.05.11 15:26:58 MESZ: Missing artifact sslext:sslext:jar:1.2-0:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.struts:struts-core:jar:1.3.8:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.struts:struts-taglib:jar:1.3.8:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.struts:struts-tiles:jar:1.3.8:compile
24.05.11 15:26:58 MESZ: Missing artifact net.htmlparser.jericho:jericho-html:jar:3.1:compile
24.05.11 15:26:58 MESZ: Missing artifact ro.isdc.wro4j:wro4j-core:jar:1.3.3:compile
24.05.11 15:26:58 MESZ: Missing artifact commons-io:commons-io:jar:2.0:compile
24.05.11 15:26:58 MESZ: Missing artifact com.google.collections:google-collections:jar:1.0:compile
24.05.11 15:26:58 MESZ: Missing artifact javax.servlet:servlet-api:jar:2.5:compile
24.05.11 15:26:58 MESZ: Missing artifact redis.clients:jedis:jar:1.5.2:compile
24.05.11 15:26:58 MESZ: Missing artifact org.mongodb:mongo-java-driver:jar:2.5.2:compile
24.05.11 15:26:58 MESZ: Missing artifact org.xhtmlrenderer:core-renderer:jar:R8pre2:compile
24.05.11 15:26:58 MESZ: Missing artifact org.apache.sanselan:sanselan:jar:0.97-incubator:compile
24.05.11 15:26:58 MESZ: Missing artifact com.kenai.nbpwr:com-sun-pdfview:jar:1.0.5-201003191900:compile
24.05.11 15:26:58 MESZ: Missing artifact org.swinglabs:pdf-renderer:jar:1.0.5:compile
24.05.11 15:26:58 MESZ: Missing artifact org.safehaus.jug:jug:jar:2.0.0:system
24.05.11 15:26:58 MESZ: Missing artifact de.dankomannhaupt:JDBCAppender:jar:1.0:system
24.05.11 15:26:58 MESZ: Missing artifact spy:memcahed:jar:2.5:system
24.05.11 15:26:58 MESZ: Missing artifact net.sf.beanlib:beanlib:jar:5.0.2beta:compile
24.05.11 15:26:58 MESZ: Missing artifact xstream:xstream:jar:1.1.2:compile
24.05.11 15:26:58 MESZ: Missing artifact net.jcip:jcip-annotations:jar:1.0:compile
24.05.11 15:26:58 MESZ: Missing artifact net.sf.beanlib:beanlib-hibernate:jar:5.0.2beta:compile
My pom.xml
looks like:
我的pom.xml
样子:
<properties>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<hibernate.version>3.3.2.GA</hibernate.version>
</properties>
<repositories>
<repository>
<id>JBoss</id>
<name>JBoss Repsitory</name>
<layout>default</layout>
<url>http://repository.jboss.org/maven2</url>
</repository>
</repositories>
<!-- Bezeichnung -->
<artifactId>project-dao</artifactId>
<name>Vevention Dao</name>
<groupId>com.corp.dao</groupId>
<version>1.0Beta</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springframework.version}</version>
<scope>system</scope>
<systemPath>${basedir}/lib/spring-security-config-3.0.5.RELEASE.jar</systemPath>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>ejb3-persistence</artifactId>
<version>1.0.2.GA</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<version>3.1.0.GA</version>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-common</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-snowball</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.0.1B</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>2.5.6.SEC01</version>
</dependency>
<dependency>
<groupId>memcached</groupId>
<artifactId>memcached</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>voldemort</groupId>
<artifactId>voldemort</artifactId>
<version>0.81</version>
</dependency>
</dependencies>
</project>
I then checked on my Mac /Users/XYZ/.m2
and all jar files are in place as expected.
然后我检查了我的 Mac /Users/XYZ/.m2
,所有 jar 文件都按预期就位。
I am using the current Maven release shipped with STS. I also enabled debug output but there was nothing suspicious.
我正在使用 STS 附带的当前 Maven 版本。我还启用了调试输出,但没有任何可疑之处。
回答by Rich Seller
There are a few other options apart from Project->Clean, some of which are more along the lines of turning it off and on again.
除了Project-> Clean之外,还有其他一些选项,其中一些更像是将其关闭和再次打开。
- Try right-clicking on the project and selecting Maven->Update Project Configuration.
- Disable then re-enable dependency management (right-click Maven->Disable Dependency Managementthen Maven->Enable Dependency Management
- Close the project and reopen it.
- Check that your Maven settings are configured correctly. If you are behind a proxy you'll need to configure the proxy settingsin the global or user settings.
- Check you're using the Maven installation you expect. By default m2eclipse uses the embedder, if you have a separate installation you may want to configure m2eclipseto use the external installation so that CLI and Eclipse builds are consistent. This also ensures you're configured to connect through any proxy as above.
- 尝试右键单击项目并选择Maven-> Update Project Configuration。
- 禁用然后重新启用依赖管理(右键Maven-> Disable Dependency Management然后Maven-> Enable Dependency Management
- 关闭项目并重新打开它。
- 检查您的 Maven 设置是否配置正确。如果您使用代理,则需要在全局或用户设置中配置代理设置。
- 检查您是否正在使用您期望的 Maven 安装。默认情况下,m2eclipse 使用嵌入器,如果您有单独的安装,您可能希望将m2eclipse 配置为使用外部安装,以便 CLI 和 Eclipse 构建一致。这也确保您配置为通过上述任何代理进行连接。
回答by cracked_all
I received this same issue on SpringSource Tools ver 2.8.0.RELEASE. I had to do Maven -> Update Maven Dependencies and check the option for "Force Update of Snapshot/Releases".
我在 SpringSource Tools ver 2.8.0.RELEASE 上收到了同样的问题。我必须执行 Maven -> 更新 Maven 依赖项并检查“强制更新快照/发布”选项。
回答by maximilianus
I encountered similar issue. The missing artifacts (jar files) exists in ~/.m2 directory and somehow eclipse is unable to find it.
我遇到了类似的问题。缺少的工件(jar 文件)存在于 ~/.m2 目录中,并且 eclipse 以某种方式无法找到它。
For example: Missing artifact org.jdom:jdom:jar:1.1:compile
例如:缺少工件 org.jdom:jdom:jar:1.1:compile
I looked through this directory ~/.m2/repository/org/jdom/jdom/1.1 and I noticed there is this file _maven.repositories. I opened it using text editor and saw the following entry:
我查看了这个目录 ~/.m2/repository/org/jdom/jdom/1.1,我注意到有这个文件 _maven.repositories。我使用文本编辑器打开它并看到以下条目:
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Wed Feb 13 17:12:29 SGT 2013
jdom-1.1.jar>central=
jdom-1.1.pom>central=
I simply removed the "central" word from the file:
我只是从文件中删除了“中心”一词:
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
#Wed Feb 13 17:12:29 SGT 2013
jdom-1.1.jar>=
jdom-1.1.pom>=
and run Maven > Update Project from eclipse and it just worked :) Note that your file may contain other keyword instead of "central".
并从 Eclipse 运行 Maven > Update Project 并且它刚刚工作:) 请注意,您的文件可能包含其他关键字而不是“central”。
回答by dongpf
I had the same problem. Rich Seller's solution didn't work for my situation, I fixed it by cancel the Window -> Preferences -> Maven
. Do not automatically update dependencies from remote repositories
option, then right-clicking on the project and selecting Maven->Update Project
.
我有同样的问题。Rich Seller 的解决方案对我的情况不起作用,我通过取消Window -> Preferences -> Maven
. Do not automatically update dependencies from remote repositories
选项,然后右键单击项目并选择Maven->Update Project
.
回答by kunal Singh
I had similar problem. it was showing error "Missing artifact......".After digging in, I found that I have proxy settings enabled which should be configured (proxyname, user/pwd) in setting.xml inside conf folder of Maven. As a resolution go to
Eclipse....Windows->preferences->Maven->UserSettings
....and update the user setting to point the setting.xml which you have inside conf folder of Maven. After that go to Project->Update All Maven Dependencies
. It should work fine after the build.
我有类似的问题。它显示错误“缺少工件......”。深入研究后,我发现我启用了代理设置,应该在Maven的conf文件夹内的setting.xml中配置(代理名称,用户/密码)。作为解决方案,转到 Eclipse .... Windows->preferences->Maven->UserSettings
.... 并更新用户设置以指向您在 Maven 的 conf 文件夹中的 setting.xml。之后去Project->Update All Maven Dependencies
。构建后它应该可以正常工作。
回答by cmjunior
I was facing the same error with Spring Boot dependencies. What solved for me was letting Maven resolve the dependencies wrapping them with dependency management:
我遇到了与 Spring Boot 依赖项相同的错误。对我来说解决的是让 Maven 解决依赖项管理包装它们的依赖项:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>...</dependency>
...
</dependencies>
</dependencyManagement>
回答by Ben
Wow, this had me tearing my hair out, banging my head against walls, tables and other things. I had the same or a similar issue as the OP where it was either missing / not downloading the jar files or downloading them, but not including them in the Maven dependencies with the same error message. My limited knowledge of java packaging and maven probably didn't help.
哇,这让我把头发扯掉,用头撞墙、桌子和其他东西。我遇到了与 OP 相同或类似的问题,它要么丢失/未下载 jar 文件或下载它们,但未将它们包含在具有相同错误消息的 Maven 依赖项中。我对 java 打包和 maven 的有限知识可能没有帮助。
For me the problem seems to have been caused by the Dependency Type "bundle"(but I don't know how or why). I was using the Add Dependency dialog in Eclipse Mars on the pom.xml, which allows you to search and browse the central repository. I was searching and adding a dependency to Hymanson-core libraries, picking the latest version, available as a bundle. This kept failing.
对我来说,问题似乎是由依赖类型“捆绑”引起的 (但我不知道如何或为什么)。我在 Eclipse Mars 中的 pom.xml 上使用 Add Dependency 对话框,它允许您搜索和浏览中央存储库。我正在搜索并添加对 Hymanson-core 库的依赖项,选择最新版本,以bundle 的形式提供。这一直失败。
So finally, I changed the dependency properties form bundle to jar(again using the dependency properties window), which finally downloaded and referenced the dependencies properly after saving the changes.
所以最后,我将依赖属性表单 bundle 更改为jar(再次使用依赖属性窗口),最终在保存更改后正确下载并引用了依赖项。
回答by Jannick
Finally, it turned out to be a missing artifact of solr that seemed to block all the rest of my build cycle.
最后,结果证明它是 solr 的一个缺失工件,它似乎阻止了我构建周期的所有其余部分。
I have no idea why mvn behaves like that, but upgrading to the latest version fixed it.
我不知道为什么 mvn 会这样,但升级到最新版本修复了它。
回答by Raviteja Gubba
I had the similar problem. Just after adding below dependency
我有类似的问题。添加以下依赖项后
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
<type>bundle</type>
</dependency>
caused the problem. I deleted that dependency even then I'm getting the same error. I don't know what happened. I tried updating the maven dependency configuration which solved my issue.
导致问题。我删除了那个依赖项,即使我遇到了同样的错误。我不知道发生了什么。我尝试更新解决了我的问题的 Maven 依赖项配置。
回答by emecas
After not much success with any of the answers available here so far.
到目前为止,这里提供的任何答案都没有取得多大成功。
My solution:
我的解决方案:
I downloaded the jar file manually and then installed the dependency by using Apache Maven install:install-file
plugin, see more details here
我手动下载了 jar 文件,然后使用 Apache Maveninstall:install-file
插件安装了依赖项,请在此处查看更多详细信息
A Full Example:
一个完整的例子:
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.4</version>
</dependency>
Download jar file from here
Install it by using the following command:
从这里下载 jar 文件
使用以下命令安装它:
mvn -X install:install-file " -DgroupId=commons-net" "-DartifactId=commons-net" "-Dversion=3.4" "-Dpackaging=jar" "-Dfile={your_full_downloads_path}/commons-net-3.4.jar"
mvn -X install:install-file " -DgroupId=commons-net" "-DartifactId=commons-net" "-Dversion=3.4" "-Dpackaging=jar" "-Dfile={your_full_downloads_path}/commons-net-3.4.jar"
- Click on the project and select
Maven->Update Project
- 单击项目并选择
Maven->Update Project