JavaPackager icon indicating copy to clipboard operation
JavaPackager copied to clipboard

Failed to execute goal io.github.fvarrui:javapackager:1.7.0-SNAPSHOT:package (linux) on project example: Could not remove folder

Open vukca opened this issue 3 years ago • 1 comments

Hello! I'm submitting a Mojo bug for the 1.7.0-SNAPSHOT version. I am unable to package my application due to strange behavior of the plugin.

[ERROR] Failed to execute goal io.github.fvarrui:javapackager:1.7.0-SNAPSHOT:package (linux) on project lavagui: Could not remove folder /home/vuk/Documents/git/sample-app/target/sample-app/jre/legal: Unable to delete directory /home/vuk/Documents/git/sample-app/target/sample-app/jre/legal. -> [Help 1]

Pom.xml

<plugin>
        <groupId>io.github.fvarrui</groupId>
        <artifactId>javapackager</artifactId>
        <version>1.7.0-SNAPSHOT</version>
        <configuration>
          <mainClass>${exec.mainClass}</mainClass>
          <bundleJre>true</bundleJre>
          <jrePath>${java.home}</jrePath>
          <generateInstaller>true</generateInstaller>
          <administratorRequired>true</administratorRequired>
          <copyDependencies>true</copyDependencies>
        </configuration>
        <executions>
          <execution>
            <id>linux</id>
            <phase>package</phase>
            <goals>
              <goal>package</goal>
            </goals>
            <configuration>
              <platform>auto</platform>
              <additionalResources>
                <additionalResource>${project.basedir}/lib/scripts</additionalResource>
              </additionalResources>
              <createZipball>true</createZipball>
              <createTarball>true</createTarball>
              <linuxConfig>
                <pngFile>${project.basedir}/src/main/resources/img/icon.png</pngFile>
                <generateAppImage>true</generateAppImage>
                <generateDeb>true</generateDeb>
                <generateRpm>true</generateRpm>
                <wrapJar>true</wrapJar>
                <categories>
                  <category>Utility</category>
                </categories>
              </linuxConfig>
            </configuration>
          </execution>
        </executions>
      </plugin>
  • JavaPackager version: 1.7.0-SNAPSHOT
  • OS version: Linux Mint 21 x86_64, Linux 5.15.0-47-generic
  • JDK version: bellsoft-java18-full-amd64 (contains JFX)
  • Build tool: Maven I am trying to figure out what could be causing such a trivial error, running the sudo mvn package on the other hand produces the following error:
Plugin io.github.fvarrui:javapackager:1.7.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact io.github.fvarrui:javapackager:jar:1.7.0-SNAPSHOT

Of course running the package command as superuser should not make any difference since the mentioned directory is not located in the protected directory.

P.S. Many thanks for creating this great plugin! :)

vukca avatar Sep 07 '22 13:09 vukca

Hi @vukca!

I've seen that you are bundling a full JDK with your app:

<jrePath>${java.home}</jrePath>

This is not a good idea, as it will add an unnecessary size to your app.

Why don't you let JavaPackager to generate a customized JRE for your app? Just omit jrePath and JavaPackager will do all the magic for you. If you have problems due to missing modules when generating a customized JRE, try also with customizedJRE=false.

I am trying to figure out what could be causing such a trivial error, running the sudo mvn package on the other hand produces the following error:

Plugin io.github.fvarrui:javapackager:1.7.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact io.github.fvarrui:javapackager:jar:1.7.0-SNAPSHOT

This could be caused due to JavaPackager 1.7.0-SNAPSHOT doesn't exist in root's .m2 folder, as it has to be installed manually because this version is not released to Maven Central. Not a good idea either! 😅

P.S. Many thanks for creating this great plugin! :)

Thanks to you for using JavaPackager!

fvarrui avatar Sep 12 '22 11:09 fvarrui

Hi @vukca! Did you manage to fix this?

fvarrui avatar Nov 28 '22 18:11 fvarrui

Hi @vukca! Did you manage to fix this?

Hi, sorry for not responding for a longer time period. I did indeed manage to create the artifacts. Anyways I was including the full JDK since I wrote the GUI application with Java 18 and had to run .jars that are confirmed to work with older versions of JRE, well that was the original idea anyway. The root of my problem was pretty silly of me and took me some time to figure out and that was the fact that I was not referencing to my local .m2 repository in which I built the 1.7.0-SNAPSHOT with Gradle but instead let the IntelliJ handle the Maven binary through the built-in one. Either way everything is solved! Thanks for help!

vukca avatar Nov 28 '22 18:11 vukca

Great!!

fvarrui avatar Nov 28 '22 19:11 fvarrui