Maven的URI无效

时间:2010-03-04 13:17:16

标签: java maven-2 build

我是maven的新手,使用mvn install我有这个错误,有什么想法吗?

提前致谢

   java.lang.IllegalArgumentException: Invalid uri 'http://maven.mysite.com:9999/repository/npg/data-recovery/${applicationVersion}/data-recovery-${applicationVersion}.pom': escaped absolute path not valid
        at hidden.org.apache.commons.httpclient.HttpMethodBase.(HttpMethodBase.java:222)
        at hidden.org.apache.commons.httpclient.methods.GetMethod.(GetMethod.java:89)
        at org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:547)
        at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
        at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
        at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
        at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:491)
        at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:372)
        at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:327)
        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
        at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
        at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
        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)
        at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedArtifact(MavenMetadataSource.java:94)
        at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:388)
        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.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:304)
        at org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDependencies(DefaultPluginManager.java:1492)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:435)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Mar 04 15:12:56 EET 2010
[INFO] Final Memory: 19M/35M

3 个答案:

答案 0 :(得分:1)

在显示的URI路径中未解析属性${applicationVersion}

'http://maven.mysite.com:9999/repository/npg/data-recovery/${applicationVersion}/data-recovery-${applicationVersion}.pom'

我想这是你的pom中配置的依赖项。您应该在pom.xml中的依赖项中找到“数据恢复” - 我敢打赌它的<version>属性设置为${applicationVersion}。如果是这样,您应该为它设置具体版本。

答案 1 :(得分:1)

您正在某处使用<version>${applicationVersion}</version>(如果继承了该版本,可能在此POM中或可能在父POM中),但此属性未解析。你需要定义这样的东西:

<project>
  <properties>
    <applicationVersion>x.y.z</applicationVersion>
  </properties>
  ...
</project>

请注意,我并没有真正看到使用这样一个属性的意义,有一个内置的${project.version}属性引用了项目的版本(例如,您可以在依赖项中使用)。有关可用属性的详细信息,请查看MavenPropertiesGuide

答案 2 :(得分:0)

使用属性在我的子模块中设置父pom版本时,我遇到了同样的问题。

您可以使用maven release插件来实现此目的。只需更新父pom文件中的版本并运行此命令即可从父文件夹更新子模块中的版本:

mvn -N versions:update-child-modules