Dependencies In Same Reactor

被刻印的时光 ゝ 提交于 2020-01-07 02:32:12

问题


I have a very simple Tycho reactor with two modules: one is a standard Maven project with this addition to make it a bundle:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <executions>
        <execution>
            <id>default-bundle</id>
            <phase>package</phase>
            <goals>
                <goal>bundle</goal>
            </goals>
            <configuration>
                <instructions>
                    <Export-Package>org.acme.jar</Export-Package>
                </instructions>
                <manifestLocation>META-INF</manifestLocation>
            </configuration>
        </execution>
    </executions>
</plugin>

The second is a Tycho project that has a dependency to the above JAR in the MANIFEST.MF.

If I start the build, I get the following exception:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: plugin 0.0.1.qualifier
[ERROR]   Missing requirement: plugin 0.0.1.qualifier requires 'bundle org.acme.jar 0.0.1' but it could not be found

Which is really weird, because the bundle is in the same reactor.

But no worries, I can just add the Maven dependency, too:

<!-- parent pom.xml -->
<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>0.26.0</version>
    <configuration>
        <pomDependencies>consider</pomDependencies>
    </configuration>
</plugin> 

<!-- plug-in pom.xml -->
<dependencies>
    <dependency>
        <groupId>org.acme</groupId>
        <artifactId>jar</artifactId>
        <version>${project.version}</version>
    </dependency>
</dependencies>

Still I get the same exception, which is weird because the documentation claims: Maven resolves the GAV dependencies according to the normal Maven rules.

That's just not true. Evidently org.acme.jar doesn't get resolved. Or maybe Tycho fails to see that it's a bundle.

The JAR module is an API project used for server side components, and we want to drop SWT / Tycho in the long run, so it's not an option to make org.acme.jar an Eclipse plug-in.

How do I define dependencies in the same reactor for Tycho?


回答1:


I’m afraid that what you ask for is currently not possible. The Tycho Wiki documents this limitation in the dependency on pom-first artifacts HOW-TO.

That being said, if you really want your whole build (maven-bundle-plugin and Tycho parts) to run with a single mvn clean install, then using the maven-invoker-plugin at the end of the “plain Maven” build to fork a “Tycho build” should work. It’s a rather cumbersome workaround, however (example on Github).



来源:https://stackoverflow.com/questions/42026028/dependencies-in-same-reactor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!