Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

${name}-${version}-runnable.jar is not found in deployment directory #355

Closed
fvarrui opened this issue Aug 16, 2023 · 27 comments
Closed

${name}-${version}-runnable.jar is not found in deployment directory #355

fvarrui opened this issue Aug 16, 2023 · 27 comments
Labels
bug Something isn't working fixed Issue fixed and release pending

Comments

@fvarrui
Copy link
Owner

fvarrui commented Aug 16, 2023

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 #335 (comment)

@fvarrui fvarrui added the bug Something isn't working label Aug 16, 2023
@fvarrui
Copy link
Owner Author

fvarrui commented Aug 17, 2023

@kia

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'.

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?

@fvarrui fvarrui added the feedback Waiting for feedback label Aug 17, 2023
@kia
Copy link

kia commented Aug 17, 2023

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

@kia
Copy link

kia commented Aug 18, 2023

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.

@fvarrui
Copy link
Owner Author

fvarrui commented Aug 18, 2023

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

@kia
Copy link

kia commented Aug 18, 2023

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

@fvarrui
Copy link
Owner Author

fvarrui commented Aug 21, 2023

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.

@fvarrui
Copy link
Owner Author

fvarrui commented Aug 21, 2023

May be the finalJarFile should be new File(outputDirectory, finalName + "-" + classifier + ".jar");

Good point! I'll do some research about this

@fvarrui fvarrui added working on Work in progress on this issue and removed feedback Waiting for feedback labels Aug 21, 2023
@kia
Copy link

kia commented Aug 21, 2023

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.

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.

@fvarrui
Copy link
Owner Author

fvarrui commented Aug 21, 2023

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.

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

@fvarrui
Copy link
Owner Author

fvarrui commented Aug 21, 2023

Just patched in branch issue-355.

Try snapshot version 1.7.4-20230821.162917-2 and give some feedback, please.

@fvarrui fvarrui added feedback Waiting for feedback and removed working on Work in progress on this issue labels Aug 21, 2023
@kia
Copy link

kia commented Aug 22, 2023

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

@fvarrui fvarrui added fixed Issue fixed and release pending and removed feedback Waiting for feedback labels Aug 22, 2023
@fvarrui
Copy link
Owner Author

fvarrui commented Aug 22, 2023

Branch issue-355 merged into devel, ready to be released in v1.7.4

@fvarrui fvarrui added the merged Changes merged into devel branch label Aug 22, 2023
@fvarrui
Copy link
Owner Author

fvarrui commented Aug 30, 2023

1.7.4 released to Maven Central

@fvarrui fvarrui closed this as completed Aug 30, 2023
@kia
Copy link

kia commented Aug 31, 2023

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.

@fvarrui fvarrui reopened this Aug 31, 2023
@fvarrui fvarrui removed fixed Issue fixed and release pending merged Changes merged into devel branch labels Aug 31, 2023
@fvarrui
Copy link
Owner Author

fvarrui commented Aug 31, 2023

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?

@kia
Copy link

kia commented Aug 31, 2023

Did you try mvn clean install ? with mvn clean package is everything fine.

@fvarrui
Copy link
Owner Author

fvarrui commented Aug 31, 2023

Did you try mvn clean install ? with mvn clean package is 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

@fvarrui
Copy link
Owner Author

fvarrui commented Aug 31, 2023

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?

@kia
Copy link

kia commented Sep 1, 2023

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

@fvarrui
Copy link
Owner Author

fvarrui commented Sep 1, 2023

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

@kia
Copy link

kia commented Sep 1, 2023

Thank you very much for your quick responses and fixes.

@kia
Copy link

kia commented Sep 18, 2023

Hi @fvarrui
At which time are you going to release 1.7.5 ?

best,
Kia

@fvarrui fvarrui added the fixed Issue fixed and release pending label Sep 25, 2023
@fvarrui
Copy link
Owner Author

fvarrui commented Sep 25, 2023

Sorry, I read your comment but forgot it. I'm going to release 1.7.5 this evening

@kia
Copy link

kia commented Sep 25, 2023

Thank you! 👍

@fvarrui
Copy link
Owner Author

fvarrui commented Sep 25, 2023

I've just released 1.7.5 to Maven Central.
I hope it works fine this time 😅 and sorry for the delay

@kia
Copy link

kia commented Sep 26, 2023

Thank you @fvarrui
I will test it as soon as it is available in maven central and let you know.

@kia
Copy link

kia commented Sep 28, 2023

Hi @fvarrui
the 1.7.5 version works.
Thank you and best regards,
Kia

@fvarrui fvarrui closed this as completed Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue fixed and release pending
Projects
None yet
Development

No branches or pull requests

2 participants