Replies: 6 comments 7 replies
-
Tycho actually runs as an extension outside the regular life-cycle.
classpath resolution should take place in the compile phase, so maybe you can explain a bit more about your "download" and why there is no other way to provide it to your build (e.g. as a maven dependency). Theoretically it should work to have an (empty) default file in the repo that is later on overwritten ... but this depends a bit on the current error. |
Beta Was this translation helpful? Give feedback.
-
@laeubi Thanks for the quick answer. <profiles>
<!-- Download jar if missing -->
<profile>
<activation>
<file>
<missing>${basedir}/lib/${somePlugin.fileName}</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<id>jar-dl</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>wget</executable>
<workingDirectory>lib</workingDirectory>
<arguments>
<argument>https://url/to/${somePlugin.fileName}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles> Maybe my approach is not conventional, in which case I will take any suggestion on the right way to do it. |
Beta Was this translation helpful? Give feedback.
-
If you can't trigger the download early enough inside the current POM by selecting a phase for it, then just move it to a separate POM and make that new POM a dependency of the current one. That would be the most simple workaround without fully understanding the root cause. dependencies are definitely built before their dependee. |
Beta Was this translation helpful? Give feedback.
-
@LuluDavid I think the issue might be related to because the classpath is resolve before the regular maven build start your jar is not considered if not present beforehand. |
Beta Was this translation helpful? Give feedback.
-
@Bananeweizen I was working with profiles at first, but I could not even make it work when I removed them for a simple curl. The problem is that my top level POM is declaring tycho for all modules, and one of these modules needs a preliminary download of an external jar. So I am not sure if I could make it work without breaking the hierarchy of my POMs. |
Beta Was this translation helpful? Give feedback.
-
@Bananeweizen In a similar fashion to your hint, I moved the download to the first module of the build (which makes sense because it is a platform target project), and it worked. So I guess the precise limitation that prevented me to download before tycho's resolution was that I tried to do it in an eclipse-plugin packaged maven project, so your idea to externalize such tasks from the plugin was the solution. Anyway, @laeubi's fix should make it feasible to combine both now if I tie my download to a phase strictly earlier than compile. I will try to test it as mentioned above, but even with a toolchains.xml file, it does not seem to work (same error). As our migration to java 11 should happen soon though, I think my fix will hold up to this point. Thanks a lot for your help ! |
Beta Was this translation helpful? Give feedback.
-
Hi, I am creating an issue because I am working currently with maven-tycho-plugin for a bunch of OSGI bundles, and I have a small problem to include preliminary instructions in my maven build before tycho's dependency resolution.
The problem is :
So in my case, as I want to download a jar that is referenced locally in one of my bundle's classpath before Tycho's dependency resolution, it does not work for the first build (but works for the second one as the jar is available then).
I found this issue that references a similar problem, but the concerned pom is packaged as pom and I tried overriding tycho-maven-plugin's executions to tie all validate-related ids (org.eclipse.tycho:tycho-packaging-plugin:${project.version}:build-qualifier,org.eclipse.tycho:tycho-packaging-plugin:${project.version}:validate-id, org.eclipse.tycho:tycho-packaging-plugin:${project.version}:validate-version) to the initialize phase instead :
Without further success.
If you have any insight or idea to solve this issue, or if my question is not relevant, feel free to answer.
Thanks for reading !
Beta Was this translation helpful? Give feedback.
All reactions