在构建项目期间,我从Ant / Maven收到以下错误:
BUILD FAILED
C:\Users\kmilyutin\git\siamprofiler\classpath.build.xml:41: The following error occurred while executing this line:
C:\Users\kmilyutin\git\siamprofiler\classpath.build.xml:33: Unable to resolve artifact: Unable to get dependency information: Unable to read the metadata file for artifact 'commons-beanutils:commons-beanutils:jar': Cannot find parent: org.apache.commons:commons-parent for project: commons-beanutils:commons-beanutils:jar:1.8.0 for project commons-beanutils:commons-beanutils:jar:1.8.0
commons-beanutils:commons-beanutils:jar:1.8.0
与此同时,与commons-beanutils
相关联的文件位于存储库中:C:\Users\kmilyutin\.m2\repository\commons-beanutils\commons-beanutils\1.8.0
有人可以帮忙解决这个问题吗?
更新:我尝试删除目录.m2\repository\commons-beanutils\
并重新构建。 Maven给了我同样的错误,但1.8.0\
目录中只有2个文件:commons-beanutils-1.8.0.pom
和commons-beanutils-1.8.0.pom.sha1
。无论出于何种原因,jar文件都会丢失,尽管我可以在Maven中央存储库中找到它。
这是调试输出:
BUILD FAILED
C:\Users\kmilyutin\git\siamprofiler\classpath.build.xml:41: The following error occurred while executing this line:
C:\Users\kmilyutin\git\siamprofiler\classpath.build.xml:33: Unable to resolve artifact: Unable to get dependency information: Unable to read the metadata file for artifact 'commons-beanutils:commons-beanutils:jar': Cannot find parent: org.apache.commons:commons-parent for project: commons-beanutils:commons-beanutils:jar:1.8.0 for project commons-beanutils:commons-beanutils:jar:1.8.0
commons-beanutils:commons-beanutils:jar:1.8.0
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
maven2-repository.dev.java.net (http://download.java.net/maven/2/),
jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public/)
Path to dependency:
1) com.sivis:siamprofiler:war:2.7.3-SNAPSHOT
2) org.richfaces.framework:richfaces-api:jar:3.3.5-SNAPSHOT
at org.apache.maven.artifact.ant.DependenciesTask.doExecuteResolution(DependenciesTask.java:268)
at org.apache.maven.artifact.ant.DependenciesTask.doExecute(DependenciesTask.java:168)
at org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifactTask.java:751)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information: Unable to read the metadata file for artifact 'commons-beanutils:commons-beanutils:jar': Cannot find parent: org.apache.commons:commons-parent for project: commons-beanutils:commons-beanutils:jar:1.8.0 for project commons-beanutils:commons-beanutils:jar:1.8.0
commons-beanutils:commons-beanutils:jar:1.8.0
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
maven2-repository.dev.java.net (http://download.java.net/maven/2/),
jboss-public-repository-group (https://repository.jboss.org/nexus/content/groups/public/)
Path to dependency:
1) com.sivis:siamprofiler:war:2.7.3-SNAPSHOT
2) org.richfaces.framework:richfaces-api:jar:3.3.5-SNAPSHOT
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:430)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:435)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(DefaultArtifactCollector.java:74)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:316)
at org.apache.maven.artifact.ant.DependenciesTask.doExecuteResolution(DependenciesTask.java:263)
... 32 more
Caused by: org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException: Unable to read the metadata file for artifact 'commons-beanutils:commons-beanutils:jar': Cannot find parent: org.apache.commons:commons-parent for project: commons-beanutils:commons-beanutils:jar:1.8.0 for project commons-beanutils:commons-beanutils:jar:1.8.0
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:200)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedArtifact(MavenMetadataSource.java:94)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:387)
... 36 more
Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent: org.apache.commons:commons-parent for project: commons-beanutils:commons-beanutils:jar:1.8.0 for project commons-beanutils:commons-beanutils:jar:1.8.0
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1396)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:255)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:163)
... 38 more
Caused by: org.apache.maven.project.InvalidProjectModelException: Parse error reading POM. Reason: end tag not allowed in epilog but got / (position: END_TAG seen ...</properties>\r\n\r\n</project>\r\n </... @639:6) for project org.apache.commons:commons-parent at C:\Users\kmilyutin\.m2\repository\org\apache\commons\commons-parent\11\commons-parent-11.pom
at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1610)
at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1571)
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:562)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
... 41 more
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: end tag not allowed in epilog but got / (position: END_TAG seen ...</properties>\r\n\r\n</project>\r\n </... @639:6)
at org.codehaus.plexus.util.xml.pull.MXParser.parseEpilog(MXParser.java:1594)
at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1405)
at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1105)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Reader.java:2133)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:3912)
at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1606)
... 44 more
Total time: 5 seconds
以下是classpath.build.xml
的一部分(第33行是artifact:dependencies
标记):
<target name="resolve-dependencies" depends="checkTimestamps,mvn-configure"
unless="${dependencies-resolved}">
<macrodef name="resolve-scoped-dependencies" xmlns:artifact="urn:maven-artifact-ant">
<attribute name="scope" />
<sequential>
<artifact:dependencies pathId="@{scope}.classpath" filesetId="@{scope}.fileset" useScope="@{scope}" >
<pom refid="maven.project" />
<localRepository refid="local.repository" />
</artifact:dependencies>
<pathconvert property="@{scope}.p" refid="@{scope}.fileset" pathsep="," />
<echo file="target/@{scope}.fileset.txt">${@{scope}.p}</echo>
</sequential>
</macrodef>
<resolve-scoped-dependencies scope="compile" />
<resolve-scoped-dependencies scope="runtime" />
<resolve-scoped-dependencies scope="provided" />
<resolve-scoped-dependencies scope="system" />
<resolve-scoped-dependencies scope="test" />
</target>
答案 0 :(得分:4)
它在消息中说明原因:
找不到父:org.apache.commons:commons-parent for project: 公地BeanUtils的:公地BeanUtils的:罐:1.8.0
为了能够找出依赖关系,maven不仅需要实际的工件元数据,还需要依赖的元数据。这就是你所缺少的。
由于commons-parent 11 required by commons-beanutils 1.8位于maven central repo,因此使用与maven central正确的网络连接进行重试应解决此问题。
但是,如果没有,请在启用调试的情况下发布完整输出(mvn -X
)。
编辑:现在有了调试输出,我们可以看到
C:\用户\ kmilyutin.m2 \库\组织\阿帕奇\公地\公地父\ 11 \公地父 - 11.pom
坏了:
org.apache.maven.project.InvalidProjectModelException: Parse error reading POM.
Reason: end tag not allowed in epilog but got / (position: END_TAG seen ...</properties>\r\n\r\n</project>\r\n </... @639:6)
for project org.apache.commons:commons-parent
at C:\Users\kmilyutin\.m2\repository\org\apache\commons\commons-parent\11\commons-parent-11.pom
作为第一个操作,请在邮件中指定的路径中从本地存储库中删除该文件,然后重试构建。