Skip to content

mvn: add page #1711

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

Merged
merged 6 commits into from
Dec 13, 2017
Merged

mvn: add page #1711

merged 6 commits into from
Dec 13, 2017

Conversation

jdvr
Copy link
Contributor

@jdvr jdvr commented Nov 29, 2017


  • The page (if new), does not already exist in the repo.

  • The page (if new), has been added to the correct platform folder:
    common/ if it's common to all platforms, linux/ if it's Linux-specific, and so on.

  • The page has 8 or fewer examples.

  • The PR is appropriately titled:
    <command name>: add page for new pages, or <command name>: <description of changes> for pages being edited

  • The page follows the contributing guidelines

@CLAassistant
Copy link

CLAassistant commented Nov 29, 2017

CLA assistant check
All committers have signed the CLA.

@tldr-bot
Copy link

The build for this PR has failed with the following error(s):

pages/common/mvn.md:23: TLDR104 Example descriptions should prefer infinitive tense (e.g. write) over present (e.g. writes) or gerund (e.g. writing)

Please fix the error(s) and push again.

@agnivade agnivade added the new command Issues requesting creation of a new page or PRs adding a new page for a command. label Nov 30, 2017
Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

There are some basic changes which needs to be done in this PR. Let's get those out of the way first and we can do the next round of review then.

@@ -0,0 +1,25 @@
# mvn

> Runnign Apache Maven.
Copy link
Member

Choose a reason for hiding this comment

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

Please improve this description to actually say what does apache maven do.


> Runnign Apache Maven.

- Most common usage is to invoke a life cicle phase:
Copy link
Member

Choose a reason for hiding this comment

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

We do not use multiple commands for a single example. If this is the most common use case, I would recommend to split this into 3 separate examples. And probably you can remove the other examples which are not so commonly used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have remove the two extra lines, it worths less that the next examples.

Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

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

Please use tokens ({{}}) wherever you have user specified variables in the commands.

@@ -0,0 +1,23 @@
# mvn

> Apache Maven. A build automation tool used for JVM environment projects.
Copy link
Member

Choose a reason for hiding this comment

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

Please move the 2nd sentence to a new line.

Copy link
Contributor

Choose a reason for hiding this comment

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

The maven docs describe mvn as:

"Tool for building and managing Java-based projects."


> Apache Maven. A build automation tool used for JVM environment projects.

- Most common usage is to invoke a life cicle phase:
Copy link
Member

Choose a reason for hiding this comment

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

typo at cycle.

This description can be improved. No need to mention "Most common usage". It does not say anything about what mvn package does. Can you expand a bit on what is meant by a life cycle phase ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a little bit difficult to add a phase definition without the maven context, what do you think about this:
"Invoke a Lifecycle phase (a set of steps for the whole project Lifecycle)"?

Copy link
Member

Choose a reason for hiding this comment

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

we can live with it.


- Invoke more that one phase with arguments:

`mvn clean -P a_profile package clean`
Copy link
Member

Choose a reason for hiding this comment

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

The phases should be in tokens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should the "a_profile" be in token?

Copy link
Member

Choose a reason for hiding this comment

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

Yes.


`mvn -X clean -P a_profile package clean`

- Use an alternative pom o directory:
Copy link
Member

Choose a reason for hiding this comment

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

o directory ? And please expand pom in brackets.

@agnivade agnivade mentioned this pull request Dec 10, 2017
5 tasks
@hohonuuli
Copy link
Contributor

Common usages I would recommend to be added:

  • Delete the target folder, which contains all build outputs:

mvn clean

  • Compile and build release package, skipping unit tests:

mvn package -Dmaven.test.skip=true

  • Install the built package in local maven repository:

mvn install


- Running an spring boot project with remote debug:

`mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"`
Copy link
Contributor

Choose a reason for hiding this comment

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

spring-boot:run is pretty esoteric. A more common maven usage would be to run a main class in your project:


  • Run a class with a main method:

mvn exec:java -Dexec.mainClass="{{com.example.Main}}" -Dexec.args="{{arg1 arg2}}"

@agnivade
Copy link
Member

I am really confused about the mvn package command.

@hohonuuli - your description says Compile and build release package
@jdvr - your description says Most common usage is to invoke a life cycle phase

Both seem very different to me. I am not a mvn user so I do not know much. However from a layman's standpoint, I would say @hohonuuli's description sounds much more clear to me.

Combining both PRs, I would recommend to have examples in this order -

mvn compile

mvn -f {{path/to/custom_pom.xml}} compile

mvn package

mvn install

mvn clean

mvn exec:java -Dexec.mainClass="{{com.example.Main}}" -Dexec.args="{{arg1 arg2}}"

@jdvr
Copy link
Contributor Author

jdvr commented Dec 12, 2017

This example are missing the fact that pass an argument to a phase like profile on package:
mvn -P {{a_profile}} package

@agnivade
Copy link
Member

That's right. Please understand that our scope in tldr is really limited and we have to be judicious in the space we use. We have a maximum limit of 8 examples and we usually try to keep it at 6. So we have to think of the most useful and simplest form of the command invocation first and then move on to the complex ones.

Keeping that in mind, I did not mention passing an argument to the mvn package command. However, if you think that it is a really important option that will be needed by beginners, you can add it.

@jdvr
Copy link
Contributor Author

jdvr commented Dec 12, 2017

I have tried to join the two PR with the best information, I've tried to add a generic examples of the commands that new members of my teams used to need.

@agnivade
Copy link
Member

Hey @jdvr - We always introduce the simplest invocation of the commands first and then move on to more complex ones. You have used mvn compile with an argument without mentioning mvn compile first. Same with mvn clean. The general convention is to mention mvn compile and mvn clean and explain what it does before moving on to more complex examples. It seems your requirements are a bit specific than the general command invocations.

Also the language of the command descriptions can be improved slightly. If you don't mind, may I edit the PR ?

@jdvr
Copy link
Contributor Author

jdvr commented Dec 12, 2017

Sure, feel free to edit the PR. compile and clean reference can be removed or replace by package

@hohonuuli
Copy link
Contributor

@jdvr Just a note that I've been using Maven for about 20 years, but I've never once used: mvn -f {{path/to/custom_pom.xml}} compile. Is that something that you find yourself using day to day? I do however, commonly skip unit tests when building a final package as they can often take a long time to run. perhaps trim the examples to:

mvn compile

mvn package

mvn package -Dmaven.test.skip=true

mvn install

mvn clean

mvn exec:java -Dexec.mainClass="{{com.example.Main}}" -Dexec.args="{{arg1 arg2}}"

@agnivade
Copy link
Member

agnivade commented Dec 13, 2017

Thanks @hohonuuli - I agree with you. I have asked around a couple of people who use maven. And collating all of their feedback, I have made the final changes. It matches almost perfectly with your suggestions. Also, I have added a few more commands which other people have found useful. I had to stretch the page to 8, but I think given the regular usage of the command, it's worth it.

EDIT - @jdvr please take a look and let me know if this looks good to you. I have deliberately avoided using the words build life cycle and phases as I think they are beyond the scope of the page. Instead, using simple words to explain what the commands do make more sense to me.

@jdvr
Copy link
Contributor Author

jdvr commented Dec 13, 2017

Yes, it looks great. Sorry for including that options, maybe my scope it is to limited :).

@agnivade
Copy link
Member

Over to you @sbrl

Copy link
Member

@sbrl sbrl left a comment

Choose a reason for hiding this comment

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

Looks ok as far as I can tell! I'm not well versed in maven itself, so I'll trust that you've got all that sorted out, @agnivade / @jdvr / @hohonuuli :P

@sbrl sbrl merged commit 1094158 into tldr-pages:master Dec 13, 2017
@Managor Managor mentioned this pull request Mar 8, 2025
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new command Issues requesting creation of a new page or PRs adding a new page for a command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants