maven-invoker不会在依赖项上调用install

时间:2013-02-05 12:12:50

标签: maven build maven-3 maven-release-plugin

我的maven构建过程中存在问题。有一个pom文件,它使用maven-invoker-plugin来执行不同的任务:

<execution>
<id>createWebstartApps</id>

<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<projectsDirectory>.</projectsDirectory>
<streamLogs>true</streamLogs>
<pomIncludes>
    <pomInclude>pom1.xml</pomInclude>
</pomIncludes>
....

但是当我使用maven发布插件“mvn release:prepare”时,不会对子pom依赖项执行安装目标。例如,pom1.xml具有以下依赖关系:

<dependency>
<groupId>com.qnamic.dis</groupId>
<artifactId>DisAdminToolWithPlugins</artifactId>
<version>${project.parent.version}</version>
<type>pom</type>
<scope>runtime</scope>
.....

但是这个依赖项(在这种情况下是pom文件)将不会安装在我的本地maven仓库中,因此无法找到:

  [INFO] [INFO] Building: pomWebstartDisAdminTool.xml
[INFO] [INFO] [INFO] Scanning for projects...
[INFO] [INFO] [INFO]
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [INFO] Building RailOpt DIS Admin Tool 4.9.12
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [WARNING] The POM for com.qnamic.dis:DisAdminToolWithPlugins:pom:4.9.12 is missing, no dependency information available
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [INFO] BUILD FAILURE
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [INFO] Total time: 0.203s
[INFO] [INFO] [INFO] Finished at: Tue Feb 05 13:00:04 CET 2013
[INFO] [INFO] [INFO] Final Memory: 4M/15M
[INFO] [INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] [ERROR] Failed to execute goal on project DisAdminToolWebstart: Could not resolve dependencies for project com.qnamic.dis:DisAdminToolWebstart:pom:4.9.12: Failure to find com.qnamic.dis:DisAdminToolWithPlugins:pom:4.9.12 in http://maven.ad.bls.ch/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of bls-public has elapsed or updates are forced -> [Help 1]

任何想法?

问候

2 个答案:

答案 0 :(得分:1)

尝试在运行前添加安装。例如

<execution>
  <id>createWebstartApps</id>
  <phase>process-resources</phase>
  <goals>
    <goal>install</goal>
    <goal>run</goal>
  </goals>
...

有关详细信息:http://maven.apache.org/plugins/maven-invoker-plugin/install-mojo.html&amp; http://maven.apache.org/plugins/maven-invoker-plugin/usage.html

HTH, 杰米

答案 1 :(得分:1)

在pom.xml旁边添加文件invoker.properties。 然后将您的目标投入其中,例如:

invoker.goals = clean install