Work nicely with the artifact generated by the shade plugin
I'm packaging my app using the Maven shade plugin to create an uber jar. I'd like to generate a repo containing the single fat jar and scripts that run the app with a classpath consisting of my config files and the fat jar. I can't seem to find a way to achieve this, is this scenario covered? If not I think it would be a nice to have. Thanks
Do you have an example project what you have tried to far?
I wanted to use it in https://github.com/torakiki/pdfsam where the https://github.com/torakiki/pdfsam/tree/master/pdfsam-community module is the one where the deliverable is created. I ended up using the maven-resources-plugin with filtering on a .bat and .sh template scripts. I don't have any non working configuration example though... what I tried is to create bundle with the same structure I create now (uber jar, scripts, config, etc), and, if I recall, the issue was that in every test I did, all the dependencies and the uber jar were included.
Dear maintainers,
Looking to do the same - I've used appassembler for years and it's great. Rather than create a new issue I'd thought I'd bump this once despite it's age.
As mentioned in the above, I'm using Shade and Proguard to obfuscate all project modules into one jar; however, the stumbling point is the produced classpath includes to the dependencies that were not obfuscated (the dependencies that contain the same class files bundled into the shaded, obfuscated JAR file). It can be fixed easily by removing the referenced JARs from the classpath but this breaks the automation process.
I have a sample project - and over 150 open tabs looking for a solution for this - so before adding this information, is this possible with the appassembler plugin?
Have used Maven and many plugins for over a decade so perhaps am going code-blind over a solution for this so apologies if this is well-documented somewhere - I've just not found it!
One other thing - what I am looking for might not even be a 'feature' of this project - in which case, I'd be more than willing to contribute to the project if required. Thanks in advance.
+1, I have had this issue as well. There should be a configuration option like includeOnlyProjectArtifact or something to support this.
However, there is a pretty easy workaround which is to run the plugin with a flat style repo, a wildcard classpath, and then run the clean plugin after the packaging:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>clean-repo</id>
<phase>package</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${path.to.your.repo}</directory>
<includes>
<include>*.jar</include>
</includes>
<excludes>
<exclude>${project.artifactId}*</exclude>
</excludes>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>