`${name}-${version}-runnable.jar` is not found in deployment directory
There is now a new issue. The ${name}-${version}-runnable.jar is not found in deployment directory. In the deployement directory i find ${name}.jar without version and 'runnable'.
Am i missing some configuration details that i have to consider in the new Version?
The very last step during packaging seems to rename the build artifact jar file. This is the message:
Concatenating files [/target/deploy/linux/assets/startup.sh,/target/deploy/linux/name-version-runnable.jar] into file [/target/deploy/linux/<name>.jar]
best, Kia
Originally posted by @kia in https://github.com/fvarrui/JavaPackager/issues/335#issuecomment-1677088268
@kia
There is now a new issue. The
${name}-${version}-runnable.jaris not found in deployment directory. In the deployement directory i find${name}.jarwithout version and 'runnable'.
As I'm seeing in your output, the runnable JAR should be in target/deploy/linux, as you are setting outputDirectory option pointing to this directory. The runnable JAR file is not there?
Am i missing some configuration details that i have to consider in the new Version?
I think nothing has been changed.
The very last step during packaging seems to rename the build artifact jar file. This is the message:
Concatenating files [/target/deploy/linux/assets/startup.sh,/target/deploy/linux/name-version-runnable.jar] into file [/target/deploy/linux/<name>.jar]
The runnable JAR is concatenated to the BASH script in order to create the executable.
I guess you made a mistake here: Concatenating files [/target/deploy/linux/assets/startup.sh,/target/deploy/linux/name-version-runnable.jar] into file [/target/deploy/linux/<name>] ... the destination of concat is not a JAR file, right?
Hi @fvarrui
I didn't change the configuration in our pom.xml . The only thing i changed was the version number of the java packager from 1.7.2 to 1.7.3 and suddenly this error occurred. When i go back to the older version of the javapackager then it works again.
But to answer your last question: the destination of concat is an executable on linux. But then there is a <name>-runnable.jar in that directory instead of a <name>-<version>-runnable.jar
In git i found that in 1.7.3 in the class io.github.fvarrui.javapackager.maven.CreateRunnableJar the line (number 91)
element("finalName", name + "-" + version)
is removed in the new Version.
This could be the cause of the problem.
I added this line again rebuild the JavaPackager and the issue is gone.
WoW!! 😮 Yes, you are right. This change was made to avoid a warning message, since new versions of maven-jar-plugin set finalName option as deprecated. If you are sure this fixes the problem, I'm going to revert this change and released a patch as 1.7.4
Hi @fvarrui,
I see the change in maven-jar-plugin. Here is explained how to define the finalName in the correct way and if I define the finalName in our pom.xml as ${name}-${version} then every thing works again without adding the deprecated parameter in io.github.fvarrui.javapackager.maven.CreateRunnableJar.
If i leave it as ${name} then the problem occur.
I think the real issue is here:
File finalJarFile = new File(outputDirectory, name + "-" + version + "-" + classifier + ".jar");
where you create the fineJarFile. May be the finalJarFile should be new File(outputDirectory, finalName + "-" + classifier + ".jar");
Best, Kia
Are you setting finalName in your POM? I mean ... maybe this was causing this issue by modifying maven-jar-plugin behaviour, since CreateRunnableJar expects a different JAR filename.
May be the
finalJarFileshould benew File(outputDirectory, finalName + "-" + classifier + ".jar");
Good point! I'll do some research about this
Are you setting
finalNamein your POM? I mean ... maybe this was causing this issue by modifyingmaven-jar-pluginbehaviour, sinceCreateRunnableJarexpects a different JAR filename.
yes. exactly. As soon as i set the finalName as ${name}-${version} everything is fine. But I would like to set the finalName as ${name}. Then there is the mismatch and the issue occur.
yes. exactly. As soon as i set the
finalNameas${name}-${version}everything is fine. But I would like to set thefinalNameas${name}. Then there is the mismatch and the issue occur.
Ok, I guessed so ... I'm working right now on this issue. I just found how to get finalName programatically, so we can determine the right name of the generated runnable JAR file
Just patched in branch issue-355.
Try snapshot version 1.7.4-20230821.162917-2 and give some feedback, please.
Hi @fvarrui .
I tested the snapshot 1.7.4-20230821.162917-2 and it works. I even changed the finalName and the JavaPackager can deal with it.
Best,
Kia
Branch issue-355 merged into devel, ready to be released in v1.7.4
1.7.4 released to Maven Central
Hi @fvarrui .
the issue is unfortunately still there in the case of mvn clean install . I tested the snapshot version with your fix with mvn clean package where it is working also in the case of 1.7.4.
The error message i got now is the following:
Failed to install artifact <artifact-name>:jar:runnable:<version>: <path>/target/deploy/linux/<finalName>-runnable.jar (No such file or directory)
where
<finalName> = ${name}
Again if i take <finalName>=${name}-${version} there is no error message and the artifact is installed.
Hi @kia! I've just tested it and can't reproduce issue with 1.7.4:
pom.xml:
<build>
<finalName>ohlala</finalName>
<plugins>
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
<version>1.7.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>package</goal>
</goals>
<configuration>
<platform>windows</platform>
<bundleJre>false</bundleJre>
<copyDependencies>true</copyDependencies>
<generateInstaller>false</generateInstaller>
<outputDirectory>target/windows</outputDirectory>
<additionalResources>
<additionalResource>src/main/resources/info.txt</additionalResource>
<additionalResource>HelloWorldMaven.l4j.ini</additionalResource>
</additionalResources>
<vmArgs>
<vmArg>-Dcustom.variable="Hi!"</vmArg>
<vmArg>-Dother.custom.variable="Bye!"</vmArg>
</vmArgs>
<fileAssociations>
<fileAssociation>
<description>HelloWorld File</description>
<extension>hello</extension>
<mimeType>application/hello</mimeType>
</fileAssociation>
</fileAssociations>
<winConfig>
<headerType>console</headerType>
<icoFile>src/main/resources/HelloWorldMaven.ico</icoFile>
</winConfig>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
mvn clean package output:
[INFO] Creating runnable JAR...
[INFO] Building jar: C:\Users\fvarrui\GitHub\HelloWorldMaven\target\windows\ohlala-runnable.jar
[INFO] Renaming file [C:\Users\fvarrui\GitHub\HelloWorldMaven\target\windows\ohlala-runnable.jar] to [HelloWorldMaven-1.0.0-runnable.jar]
[INFO] Runnable jar created in C:\Users\fvarrui\GitHub\HelloWorldMaven\target\windows\HelloWorldMaven-1.0.0-runnable.jar!
Am I missing anything?
Did you try mvn clean install ? with mvn clean package is everything fine.
Did you try
mvn clean install? withmvn clean packageis everything fine.
Oh! 😓 sorry, I didn't read well your message, I see ... JP is renaming the runnable JAR to {name}-{version}-runnable.jar, so it fails when trying to install the original JAR into the local Maven repo
Ok, I've coded a patch, merged it into devel branch, and publish as a snapshot: 1.7.5-20230831.204758-1
Now JP keeps the name of the runnable JAR. I could't test it exhaustively, so, please, test it and give me some feedback. Could you test it on all platforms?
Hi @fvarrui Now it seems that every thin is fine.
I tested both mvn clean package and mvn clean install on linux, mac and windows platforms with the snapshot version 1.7.5-20230831.204758-1.
best, Kia
JP is renaming the runnable JAR to {name}-{version}-runnable.jar, so it fails when trying to install the original JAR into the local Maven repo
Great!!! And sorry, I didn't realize about this behaviour. I'm going to release JP 1.7.5 with this patch ASAP
Thank you very much for your quick responses and fixes.
Hi @fvarrui At which time are you going to release 1.7.5 ?
best, Kia
Sorry, I read your comment but forgot it. I'm going to release 1.7.5 this evening
Thank you! :+1:
I've just released 1.7.5 to Maven Central. I hope it works fine this time 😅 and sorry for the delay
Thank you @fvarrui I will test it as soon as it is available in maven central and let you know.
Hi @fvarrui the 1.7.5 version works. Thank you and best regards, Kia