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

[feature][tool] Add the Maven wrapper #10487

Merged
merged 1 commit into from May 23, 2022
Merged

Conversation

cbornet
Copy link
Contributor

@cbornet cbornet commented May 5, 2021

Motivation

  • The maven wrapper helps getting started quickly without having to install Maven
  • It helps to control that a working version of Maven is used

Modifications

  • Added the wrapper
  • Modified READMEs to use the wrapper

Scripts and CI still use the unwrapped mvn command and Maven is still indicated as a requirement but this could be changed in a later PR.

Verifying this change

Install the project with ./mvnw install -DskipTests

  • Make sure that the change passes the CI checks.

This change is a trivial rework

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (yes / no) no
  • The public API: (yes / no) no
  • The schema: (yes / no / don't know) no
  • The default values of configurations: (yes / no) no
  • The wire protocol: (yes / no) no
  • The rest endpoints: (yes / no) no
  • The admin cli options: (yes / no) no
  • Anything that affects deployment: (yes / no / don't know) no

Documentation

  • Does this pull request introduce a new feature? (yes / no) yes
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented) in READMEs
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

very good

Do we have to add .mvn\wrapper in .gitignore ?
otherwise someone may end in committing the compiled wrapper.jar ?

@cbornet
Copy link
Contributor Author

cbornet commented May 5, 2021

The Maven binary is downloaded into the ~/.m2 directory so there's no need to add it to gitignore

@lhotari
Copy link
Member

lhotari commented May 5, 2021

Now that maven 3.8.1 is used, it should be possible to remove the hack which replaces maven's wagon-http jar file. That solution is in build/replace_maven-wagon-http-version.sh script. The script is referenced from the GHA workflows in .github/workflows.

@lhotari
Copy link
Member

lhotari commented May 5, 2021

Would it make sense to cache the downloaded Maven binary with GHA cache?

eolivelli
eolivelli previously approved these changes May 5, 2021
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

@lhotari
There is no need to use mvnw in CI.

btw we could enhance CI as a separate step.

@eolivelli
Copy link
Contributor

@cbornet thank you for providing this patch.

before merging this kind of patches it is better to start a discussion on dev@pulsar and see what is the feeling from the community

@eolivelli
Copy link
Contributor

@lhotari
Copy link
Member

lhotari commented May 5, 2021

There is no need to use mvnw in CI.

@eolivelli there would be a benefit of using mvnw since we could get rid of the wagon-http upgrade hack which is required in CI. mvnw is able to pull a specific maven version, which is 3.8.1 that contains the required fixes to wagon-http.

btw we could enhance CI as a separate step.

that's true.

.mvn/wrapper/MavenWrapperDownloader.java Outdated Show resolved Hide resolved
README.md Outdated
@@ -93,32 +93,32 @@ Requirements:
Compile and install:

```bash
$ mvn install -DskipTests
$ ./mvnw install -DskipTests
Copy link
Member

Choose a reason for hiding this comment

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

does this script works for Windows environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On Windows it's the mvn.cmd script that shall be used.

Copy link
Member

Choose a reason for hiding this comment

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

How do people know to use mvn.cmd?

If people use its local maven installation, mvn install ... works across different operating systems.

I am not against adding the mvn wrapper. But I don't think we should change the documentation. Once you change the documentation, you make people using windows hard to get started on building pulsar.

Copy link
Contributor

Choose a reason for hiding this comment

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

you can still use class "mvn" command.
you are not forced to use mvnw.

IIRC on Windows when you have "mvnw.cmd" you can use "mvnw" as command, like for .bat files

so the usage is the same on Linux/Mac/Windows, it is always "./mvnw". (probably on windows you can also omit './')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is someone able to test it on Windows ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On Windows, ./mvnw won't work on standard terminal. You need to either use mvnw or .\mvnw

@cbornet
Copy link
Contributor Author

cbornet commented May 12, 2021

/pulsarbot run-failure-checks

@cbornet
Copy link
Contributor Author

cbornet commented May 12, 2021

I changed the README to keep mvn in the command sample and added a note on how to use the wrapper.
cc @sijie

sijie
sijie previously requested changes May 15, 2021
Copy link
Member

@sijie sijie left a comment

Choose a reason for hiding this comment

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

.mvn/wrapper/maven-wrapper.jar

Per ASF policy, we don't recommend adding binary into the source code repo. This should be removed.

@cbornet
Copy link
Contributor Author

cbornet commented May 17, 2021

done

@cbornet cbornet requested a review from sijie May 18, 2021 18:43
@cbornet
Copy link
Contributor Author

cbornet commented Jun 3, 2021

I believe this could be merged ?

@sijie
Copy link
Member

sijie commented Jun 3, 2021

@codelipenghui is releasing 2.8.0. will merge it once 2.8.0 is done.

@cbornet
Copy link
Contributor Author

cbornet commented Jul 22, 2021

Hi, can this have another shot now that 2.8 is out ?

@cbornet
Copy link
Contributor Author

cbornet commented Aug 26, 2021

Hi, can this be merged ?

@eolivelli
Copy link
Contributor

@sijie @codelipenghui it would be good to merge this before 2.9.0 release

@cbornet
Copy link
Contributor Author

cbornet commented Nov 10, 2021

Hi, can this be merged ?

@eolivelli
Copy link
Contributor

@cbornet thanks for this useful work.

If there is no discussion on the dev@ list please start a new thread or ping on the existing thread.

here you will have a smaller audience

@eolivelli
Copy link
Contributor

@codelipenghui @sijie mentioned you in this thread.
it is time to commit this patch ?

also @sijie can you please update your "Request for changes" review if you think it is time to go with this patch

@cbornet
Copy link
Contributor Author

cbornet commented Apr 10, 2022

Hi. Can this be merged or closed ?

@eolivelli eolivelli dismissed sijie’s stale review April 20, 2022 08:15

This patch is very old, it need re-evaluating

.mvn/wrapper/maven-wrapper.properties Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
.mvn/wrapper/maven-wrapper.properties Outdated Show resolved Hide resolved
@cbornet cbornet force-pushed the mvn-wrapper branch 2 times, most recently from 8d1f212 to ab38c2d Compare May 13, 2022 12:44
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

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

@cbornet - it's probably also worth updating the contributor's guide: https://pulsar.apache.org/contributing/.

Copy link
Contributor

@merlimat merlimat left a comment

Choose a reason for hiding this comment

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

LGTM. We should also update the CI to use mvnw so that we standardize on 1 version of maven. We have seen that there are some small changes in the dependencies list depending on the maven version.

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

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

LGTM. Is there any reason we shouldn't cherry pick to this to active maintenance branches? It seems like it'd ensure a more consistent environment when releasing new versions, which would be valuable.

@github-actions
Copy link

@cbornet:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@michaeljmarshall michaeljmarshall added doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. and removed doc-label-missing labels May 13, 2022
@eolivelli
Copy link
Contributor

LGTM. Is there any reason we shouldn't cherry pick to this to active maintenance branches? It seems like it'd ensure a more consistent environment when releasing new versions, which would be valuable.

I believe that this change is harmless and we can commit to every active branch (up to to 2.8)

@cbornet cbornet changed the title Add the Maven wrapper [feature][tool] Add the Maven wrapper May 21, 2022
@eolivelli eolivelli merged commit ec9237a into apache:master May 23, 2022
@cbornet cbornet deleted the mvn-wrapper branch May 23, 2022 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants