Skip to content

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Mar 8, 2019

Fixes: #1305

@geoand geoand changed the title Apply single jar fix in non uberJar case as well Apply single jar rename in non uberJar case as well Mar 8, 2019
@cescoffier
Copy link
Member

If the runner jar is still the main artifact, don't rename it, that can break other plugins.

@geoand
Copy link
Contributor Author

geoand commented Mar 8, 2019

What gets renamed with this PR is not the -runner jar file, but the original .jar file produced by Maven itself.
Would renaming that be a problem you think? We already do what when uberJar is configured.

@vorburger
Copy link
Contributor

Please hold off merging this until I can test if this PR actually fixes #1305 ... will try to do so ASAP. Based on what I meanwhile learnt in #1344 (which I didn't fully understand before), it may actually not. It could still be "nice" to do something like this though - but that would be separate from and not really related to #1344 anymore.

@vorburger
Copy link
Contributor

Actually... it's a PITA 😈 to properly test this - because I'd have to get the maven build running inside the S2I builder container to use v999-SNAPSHOT artifacts outside of the container; doable with more effort - but no point: Now that I understand the libs/ business, I don't see how it could work as-is until we do more work in the S2I Builder to also copy libs/ - would you agree @geoand ?

So I think this PR is still a good idea so that we are ready for later, but it (alone) does not fix #1305.

@geoand
Copy link
Contributor Author

geoand commented Mar 8, 2019

@vorburger agreed! it is not going to work for s2i since the assemble script will not copy the lib directory

@cescoffier
Copy link
Member

Ok, but do we want to suffer from startup penalty because of this?

@geoand
Copy link
Contributor Author

geoand commented Mar 8, 2019

I would say that it would be best to get S2I fixed and not use the uberJar as the primary option but I'm not sure how easily/quickly that could happen

@cescoffier
Copy link
Member

it seems the @gastaldi has a secret he may wants to share with us...

@gastaldi
Copy link
Contributor

gastaldi commented Mar 8, 2019

I fixed that in the Launcher using the registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift builder image and:

Adding the following to the pom.xml

    <finalName>${project.artifactId}</finalName>

Adding the following BuildConfig parameters

JAVA_APP_JAR=app-runner.jar
ARTIFACT_COPY_ARGS="-p -r lib/ $JAVA_APP_JAR"

@geoand
Copy link
Contributor Author

geoand commented Mar 8, 2019

Thanks @gastaldi!

So this PR if merged would mean that only ARTIFACT_COPY_ARGS would be required

@cescoffier
Copy link
Member

@geoand which PR?

@geoand
Copy link
Contributor Author

geoand commented Mar 8, 2019

The current one we are talking in :).
If applied is would change an output like this:

-rw-r--r--. 1 jboss root 34673 Mar  7 13:49 quarkus-quickstart-1.0-SNAPSHOT-runner.jar
-rw-r--r--. 1 jboss root  3353 Mar  7 13:49 quarkus-quickstart-1.0-SNAPSHOT.jar

to one like this:

-rw-r--r--. 1 jboss root 34673 Mar  7 13:49 quarkus-quickstart-1.0-SNAPSHOT-runner.jar
-rw-r--r--. 1 jboss root  3353 Mar  7 13:49 quarkus-quickstart-1.0-SNAPSHOT.jar.original

thus making JAVA_APP_JAR redundant

@cescoffier
Copy link
Member

@geoand did you see my comment on the main artifacts with some maven plugin?

@cescoffier
Copy link
Member

(and sorry, I'm bit exhausted)

@geoand
Copy link
Contributor Author

geoand commented Mar 8, 2019

(and sorry, I'm bit exhausted)

No worries, I completely understand :)

@geoand
Copy link
Contributor Author

geoand commented Mar 8, 2019

@geoand did you see my comment on the main artifacts with some maven plugin?

Would you then propose that the -runner suffix be removed in this case?
Making the output something like:

-rw-r--r--. 1 jboss root 34673 Mar  7 13:49 quarkus-quickstart-1.0-SNAPSHOT.jar
-rw-r--r--. 1 jboss root  3353 Mar  7 13:49 quarkus-quickstart-1.0-SNAPSHOT.jar.original

(which is what Spring Boot does BTW)

@cescoffier
Copy link
Member

I need to check which one is declared as the main artifact. I believe it's the "original" jar.

@geoand
Copy link
Contributor Author

geoand commented Mar 8, 2019

I need to check which one is declared as the main artifact. I believe it's the "original" jar.

Let me know what possible failures/pitfalls you have in mind, because I didn't see any to be honest :)

@gsmet
Copy link
Member

gsmet commented Mar 12, 2019

@geoand could you rebase please?
@cescoffier could you check your theory? I think we're good as, even with a final name, the runner jar was suffixed -runner.

@geoand
Copy link
Contributor Author

geoand commented Mar 12, 2019

@gsmet PR rebased onto latest master

@cescoffier
Copy link
Member

cescoffier commented Mar 12, 2019

No we are not good. The main artifact currently is the bare one:

[INFO] --- maven-install-plugin:2.4:install (default-install) @ getting-started ---
[INFO] Installing /Users/clement/tmp/foo/target/getting-started-1.0-SNAPSHOT.jar to /Users/clement/.m2/repository/org/acme/getting-started/1.0-SNAPSHOT/getting-started-1.0-SNAPSHOT.jar
[INFO] Installing /Users/clement/tmp/foo/pom.xml to /Users/clement/.m2/repository/org/acme/getting-started/1.0-SNAPSHOT/getting-started-1.0-SNAPSHOT.pom

Actually, the runner is not even attached to the project and thus not installed/deployed.

We cannot use the runner as main artifact as it would break dependencies.

So we must still produce the bare artifact and it should be the main artifact.

@gsmet
Copy link
Member

gsmet commented Mar 12, 2019

@cescoffier I don't understand how your comment is related to this PR? AFAICS, it just renames the main jar to .original when building the runner jar, which we do anyway if the uberJar option is enabled?

Why does it become a problem now?

@geoand
Copy link
Contributor Author

geoand commented Mar 12, 2019

I see the problem the problem that @cescoffier mentions as well.

@gsmet In a generated project if the user does mvn install it will fail with this PR because there is no jar with expected name that the install plugin expects.
However even if the user does mvn install without the PR, the jar that gets installed doesn't make much sense.

@cescoffier
Copy link
Member

If we change the jar name, we must update the Mojo to declare this new file as the main artifact. And even with this, it can be weird. If the finalName is set, this finalName must be used despite the naming done in this PR.

@geoand
Copy link
Contributor Author

geoand commented Mar 12, 2019

@cescoffier Would it make sense to disable the maven install plugin for the generated projects?
Does doing install even make sense on a Quarkus project?

@gsmet
Copy link
Member

gsmet commented Mar 12, 2019

Hmmm, OK. The problem is not new though as we already do this if the uberJar option is enabled. I could see how it could become a more widespread issue if we do it in all cases.

@cescoffier
Copy link
Member

"install" still make sense. You can depends on classes and resources from your application.

@geoand
Copy link
Contributor Author

geoand commented Mar 12, 2019

"install" still make sense. You can depends on classes and resources from your application.

Understood, makes absolute sense

@geoand
Copy link
Contributor Author

geoand commented Mar 12, 2019

@gsmet @cescoffier I guess I should close this PR for time being since I don't thing we have a good solution around the install issue at this point.

@gsmet
Copy link
Member

gsmet commented Mar 12, 2019

OK, closing then.

@gsmet gsmet closed this Mar 12, 2019
@geoand geoand deleted the #1305 branch March 12, 2019 14:28
@gsmet gsmet added the triage/invalid This doesn't seem right label Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage/invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants