Apache maven is an advanced project management tool for java software projects which is based on POM (project object model). Command to check the maven version in windows c: > mvn –version.
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:) Maven home: D: apache-maven-3.0.5 bin. Java version: 1.6.025, vendor: Sun Microsystems Inc. Java home: C: Program Files Java jdk1.6.025 jre Default locale: nlNL, platform encoding: Cp1252 OS name: 'windows 7', version: '6.1', arch: 'amd64', family: 'windows' Depending upon your network setup, you may require extra configuration. Check out the if necessary. If you are using Windows, you should look at to ensure that you are prepared to use Maven on Windows. Mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false If you have just installed Maven, it may take a while on the first run. This is because Maven is downloading the most recent artifacts (plugin jars and other files) into your local repository.
You may also need to execute the command a couple of times before it succeeds. This is because the remote server may time out before your downloads are complete.
Don't worry, there are ways to fix that. You will notice that the generate goal created a directory with the same name given as the artifactId. Change into that directory. 4.0.0 com.mycompany.app my-app 1.0-SNAPSHOT 1.8 1.8 junit junit 4.12 test. INFO - INFO BUILD SUCCESSFUL INFO - INFO Total time: 2 seconds INFO Finished at: Thu Jul 07 21:34:52 CEST 2011 INFO Final Memory: 3M/6M INFO - Unlike the first command executed ( archetype:generate) you may notice the second is simply a single word - package. Rather than a goal, this is a phase.
A phase is a step in the, which is an ordered sequence of phases. When a phase is given, Maven will execute every phase in the sequence up to and including the one defined. For example, if we execute the compile phase, the phases that actually get executed are:. validate. generate-sources.
Maven Project Version Management The Most Elegant Software For Mac Mac
process-sources. generate-resources. process-resources. compile You may test the newly compiled and packaged JAR with the following command. Maven Phases Although hardly a comprehensive list, these are the most common default lifecycle phases executed. validate: validate the project is correct and all necessary information is available.
compile: compile the source code of the project. test: test the compiled source code using a suitable unit testing framework.
These tests should not require the code be packaged or deployed. package: take the compiled code and package it in its distributable format, such as a JAR. integration-test: process and deploy the package if necessary into an environment where integration tests can be run. verify: run any checks to verify the package is valid and meets quality criteria. install: install the package into the local repository, for use as a dependency in other projects locally. deploy: done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
There are two other Maven lifecycles of note beyond the default list above. They are. clean: cleans up artifacts created by prior builds. site: generates site documentation for this project Phases are actually mapped to underlying goals. The specific goals executed per phase is dependant upon the packaging type of the project.
For example, package executes jar:jar if the project type is a JAR, and war:war if the project type is - you guessed it - a WAR. An interesting thing to note is that phases and goals may be executed in sequence.
No, there isn't. You always have to specify parent's version. Fortunately, it is inherited as the module's version what is desirable in most cases. Moreover, this parent's version declaration is bumped automatically by Maven Release Plugin, so - in fact - it's not a problem that you have version in 2 places as long as you use Maven Release Plugin for releasing or just bumping versions.
Notice that there are some cases when this behaviour is actually pretty OK and gives more flexibility you may need. Sometimes you want to use some of previous parent's version to inherit, however that's not a mainstream case. EFox's answer worked for a single project, but not when I was referencing a module from another one (the pom.xml were still stored in my.m2 with the property instead of the version). However, it works if you combine it with the flatten-maven-plugin, since it generates the poms with the correct version, not the property.
The only option I changed in the plug-in definition is the outputDirectory, it's empty by default, but I prefer to have it in target, which is set in my.gitignore configuration: org.codehaus.mojo flatten-maven-plugin 1.0.1 true target flatten process-resources flatten The plug-in configuration goes in the parent pom.xml.