4

In npm we can define scripts such as:

"start": "npm-run-all --parallet test lint ..."

and run it using the short command npm start.

Can we do the same using a Maven project?

The idea is from using npm and Node.js for a while. Current I use maven profile to config all relevant configuration and use -D profile to run command. But sometimes I need to disable tests using -Dmaven.test.skip=true, it's and even worse when I update project version.

mvn build-helper:parse-version versions:set \
 -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0 \
 versions:commit

If possible I want to shorten the command to mvn build-nextMinor.

E_net4
  • 27,810
  • 13
  • 101
  • 139
Se Song
  • 1,613
  • 2
  • 19
  • 32

1 Answers1

1

No, I doubt that this is possible.

Usually, you define all relevant configuration for the plugins in the POM, then just call something like mvn clean install.

If you need different configurations, you can use profiles in your POM and activate them through the command line.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • 1
    Yes, this's what I am using, but some time I still need to run long command such as skip test, update project version... another solution is using IDE. but all of these not as well as NPM scripts. thanks – Se Song Feb 01 '19 at 09:47
  • You can also define shell commands for your common use cases. – J Fabian Meier Feb 01 '19 at 16:28