Maven Shade Plugin Snapshot

Hi,

Does anyone know how to get GitHub Actions to compile and shade Java with a Maven snapshot version of the shade plugin?

I’m upgrading my code bases to Java 16 and I need to use version 3.3.0-SNAPSHOT of the Maven Shade plugin to get the code to compile because previous versions do not support Java 16. To do that in Maven, I declare the Maven Snapshot repo in my POM:

        <repository>
            <!-- This is a temporary reference as the Maven Shade plugin 
                that supports Java 16 is not released yet -->
            <id>maven-snapshots</id>
            <url>https://repository.apache.org/content/repositories/snapshots/</url>
        </repository>

And then use the appropriate version in the plugin:

           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0-SNAPSHOT</version>
 ...

This compiles fine on Jenkins and locally, but when using GitHub Actions, I get this error:

Error:  Plugin org.apache.maven.plugins:maven-shade-plugin:3.3.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-shade-plugin:jar:3.3.0-SNAPSHOT -> [Help 1]
90
Error:  
91
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
92
Error:  Re-run Maven using the -X switch to enable full debug logging.
93
Error:  
94
Error:  For more information about the errors and possible solutions, please read the following articles:
95
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
96
Error: Process completed with exit code 1.

Is there a way to get Actions to use the declared repo? Or is there another way?

Links:
Action Build Failure: Fix Java 16 compilation. · BentoBoxWorld/Challenges@015b5d3 · GitHub
Project: GitHub - BentoBoxWorld/Challenges: Add-on for BentoBox to add challenges for BSkyBlock and AcidIsland

Thanks in advance!

1 Like

Hi! I’m afraid I’m not sure what’s happening so hopefully other members can chime in.

In the meantime, while it might not resolve the issue, we do recommend using the latest releases of our Actions:

Thanks. I updated to v2 for those, but the issue still remains. It seems the maven snapshot repo is ignored.

I found out how to fix it. In Maven there is an option to specify plugin repos. So adding this to the POM makes it work:

<pluginRepositories>
  <pluginRepository>
    <id>apache.snapshots</id>
    <url>https://repository.apache.org/snapshots/</url>
  </pluginRepository>
</pluginRepositories>