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

Fix maven wrapper not working in codestarts #12170

Merged
merged 1 commit into from
Sep 25, 2020

Conversation

ia3andy
Copy link
Contributor

@ia3andy ia3andy commented Sep 17, 2020

maven-wrapper.properties is necessary to automatically download the jar
it was working by luck when a parent folder contains a directory

@ia3andy
Copy link
Contributor Author

ia3andy commented Sep 17, 2020

@gsmet this is the issue I am talking about. This is a serious issue as when using .mvn (and not .mvn directory is found) you get:

./mvnw clean package
./mvnw: line 276: /var/folders/0b/523v4n4x6j31mhnl9b1y107h0000gn/T/test-zip4097302522953819324/test-app-maven-java/.mvn/wrapper/maven-wrapper.properties: No such file or directory
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file 
Warning: /var/folders/0b/523v4n4x6j31mhnl9b1y107h0000gn/T/test-zip4097302522953
Warning: 819324/test-app-maven-java/.mvn/wrapper/maven-wrapper.jar: No such 
Warning: file or directory
  2 50710    2  1047    0     0   5024      0  0:00:10 --:--:--  0:00:10  5033
curl: (23) Failed writing body (0 != 1047)
Erreur : impossible de trouver ou de charger la classe principale org.apache.maven.wrapper.MavenWrapperMain
Causé par : java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain

@ia3andy
Copy link
Contributor Author

ia3andy commented Sep 17, 2020

this was undetected because all the tests are running in a quarkus subfolder, and quarkus contains the .mvn dir

@ia3andy
Copy link
Contributor Author

ia3andy commented Sep 17, 2020

The MavenWrapperDownloader.tpl.qute.java file is copied from the wrapper files, I just added the wrapper version inside it.

* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this expression resolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aloubyansky this is not my code, but copied from the maven wrapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/{maven.version}/maven-wrapper-{maven.version}.jar"
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/{maven.wrapper-version}/maven-wrapper-{maven.wrapper-version}.jar"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just to be clear: I think it's a VERY bad idea to have copied the Maven Wrapper in our code. It's going to be a nightmare to maintain.

Not related to this PR per se though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @gsmet here. Ideally the Maven Wrapper plugin should be run to produce these artifacts to avoid people from maintaining this snippet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gastaldi @gsmet if you look closer, you will see that we just provides the scripts (not the actual wrapper) which is downloaded automatically when the user first start the command.

The scripts shouldn't change very often (and are not coupled to any version) so it shouldn't be a burden to maintain them.

Regarding the maven version, we could make it dynamic using the maven version used during the build, I didn't have time to do it and didn't know if it wasn't better to have it coded?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ia3andy I know, it's the wrapper script I was referring to. Since this is auto-generated from the Tanaki plugin I don't see the point why we need to replicate that behavior.

Just my 2c ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gastaldi feel free to submit a PR that auto-generate those files in the src/main/resources/codestarts/quarkus/core/tooling/maven-wrapper/base/ directory, that would be cool indeed. Just be careful not to avoid generating the jar, and if you do it, you could also remove the data in the codestart.yml as the version will already be in the generated file.

@gsmet
Copy link
Member

gsmet commented Sep 17, 2020

This won't be in 1.8.1, I tried to backport it and it's not a clean backport, there are probably other PRs to backport before this one and it's too late for that.

It will have to wait for 1.8.2 if we do an 1.8.2 and you will either have to mark other PRs for backport or write a specific patch.

@ia3andy
Copy link
Contributor Author

ia3andy commented Sep 18, 2020

@gsmet should we merge this PR or rerun CI?

@gastaldi gastaldi added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Sep 18, 2020
maven-wrapper.properties is necessary to automatically download the jar
it was working by luck when a parent folder contains a  directory
@gsmet gsmet force-pushed the fix-maven-wrapper-bug-codestarts branch from d6867f6 to 7701784 Compare September 18, 2020 21:36
@gsmet
Copy link
Member

gsmet commented Sep 18, 2020

Got hit by CI master issue, I rebased and force pushed.

@ia3andy
Copy link
Contributor Author

ia3andy commented Sep 25, 2020

JDK 15 Failing because of:
[INFO] Quarkus - Integration Tests - Amazon Services ...... FAILURE [01:05 min]:,

merging..

[INFO] 
[INFO] --- docker-maven-plugin:0.31.0:start (docker-start) @ quarkus-integration-test-amazon-services ---
[INFO] DOCKER> Pulling from localstack/localstack
[INFO] DOCKER> Digest: sha256:24ad2fa35f0dceb1985af0d7099059afb8fe9ab7256769f2d66059f7db8bf228
[INFO] DOCKER> Status: Downloaded newer image for localstack/localstack:0.11.1
[INFO] DOCKER> Pulled localstack/localstack:0.11.1 in 21 seconds 
[INFO] DOCKER> [localstack/localstack:0.11.1] "aws-local-stack": Start container fb5bf0511a19
Error:  DOCKER> [localstack/localstack:0.11.1] "aws-local-stack": Timeout after 30097 ms while waiting on log out '^Ready\.$'
Error:  DOCKER> Error occurred during container startup, shutting down...
Error:  DOCKER> IO Error while requesting logs: java.io.IOException: Bad file descriptor Thread-1503
[INFO] DOCKER> [localstack/localstack:0.11.1] "aws-local-stack": Stop and removed container fb5bf0511a19 after 0 ms
Error:  DOCKER> I/O Error [[localstack/localstack:0.11.1] "aws-local-stack": Timeout after 30097 ms while waiting on log out '^Ready\.$']

@ia3andy ia3andy merged commit cad05cb into quarkusio:master Sep 25, 2020
@ia3andy ia3andy deleted the fix-maven-wrapper-bug-codestarts branch September 25, 2020 07:43
@gsmet gsmet added this to the 1.9.0 - master milestone Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants