我有一个带有目标定义文件的多模块Tycho构建。目标定义在其自己的项目中定义(ID:org.acme.project.target
,包装类型:pom
),如下所示:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>platform_rcp.target</file>
<type>target</type>
<classifier>platform_rcp</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Maven父母就像这样指向这个目标平台:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<resolver>p2</resolver>
<target>
<artifact>
<groupId>${project.groupId}</groupId>
<artifactId>org.acme.project.target</artifactId>
<version>${project.version}</version>
<classifier>platform_rcp</classifier>
</artifact>
</target>
</configuration>
</plugin>
只要我构建父项目,此设置就会起作用。当我构建其中一个子模块时,即使该项目复制了对目标平台的引用,或者即使我使用mvn install -pl org.acme.project
构建父项,我也会遇到以下异常:
[ERROR] Internal error: java.lang.RuntimeException: Could not resolve target platform specification artifact myGroup:org.acme.project.target:target:platform_rcp:2.3.0-SNAPSHOT -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: Could not resolve target platform specification artifact myGroup:org.acme.project.target:target:platform_rcp:2.3.0-SNAPSHOT
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
即使the Tycho example对我来说也不起作用,但会带来相同的错误消息(Could not resolve target platform specification artifact example.group:mars:target:1.0.0-SNAPSHOT
)。
我认为this question是相似的,但我的设置正是在答案中所说的。
我做错了什么?
(有问题的实际问题是that Eclipse Mars can't run integration tests,所以我只能使用Tycho来运行它们,当Tycho构建所有模块时需要很长时间。)
答案 0 :(得分:0)
即使我用mvn install -pl org.acme.project构建父代,我也会遇到以下异常:
您是否尝试将目标平台项目预先添加到-pl
参数列表中:mvn install -pl :mars,org.acme.project
我一直都在使用它。