Using spotless-maven-plugin with Eclipse JDT behind custom P2 mirror
In our company we have the situation that we need to load the P2 artifacts required by Eclipse JDT from a custom JFrog Artifactory registry. We have the following two issues:
- The P2 mirror requires authentication. How can I set this via the plugin configuration?
- We want to open source our Java project and therefore not include custom configuration in the
pom.xml. When persons from outside the company pull our code from GitHub, they dont need the p2Mirror configuration. Is there a possibility to configure the P2 mirror via configuration files likesettings.xmlin Maven? Or maybe introduce environment variables the plugin checks to load from custom mirrors?
Thanks very much in advance!
I actually found a small workaround by defining custom properties in the pom.xml using
<!-- Spotless configuration for P2 mirror -->
<p2.credentials /> <!-- must be empty, override this via Maven's settings.xml file if custom P2 mirror needed -->
<p2.mirror>download.eclipse.org</p2.mirror> <!-- do not touch, override this via Maven's settings.xml file if custom P2 mirror needed -->
and using them in Spotless plugin configuration via
<p2Mirror>
<prefix>https://download.eclipse.org</prefix>
<url>https://${p2.credentials}@${p2.mirror}</url>
</p2Mirror>
This way the defaults from the properties above are picked up when running spotless outside of our internal network.
Via the settings.xml file on the internal machines we can override it by using profile properties like this:
<profiles>
<profile>
<properties>
<p2.credentials>username:password</p2.credentials>
<p2.mirror>my.domain.com/customp2/</p2.mirror>
</properties>
</profile>
</profiles>
@nedtwigg What do you think about this workaround? It only requires little adjustments on the local machine. Of course it would be way better if the maven repositories defined in the settings.xml pointing to our internal artifactory would be automatically picked up instead of passing it to the plugin through the pom.xml configuration.
This feature is great, thanks for your contributionš