mvn --version
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
mvn package
java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
A POM requires that its groupId, artifactId, and version be configured. These three values form the project's fully qualified artifact name. This is in the form of <groupId>:<artifactId>:<version>.
If you are using Eclipse IDE, just call:
mvn eclipse:eclipse
or from Eclipse, import existing Maven Projects
The standard for a Maven repository is to store an artifact in the following directory relative to the root of the repository:
/<groupId>/<artifactId>/<version>/<artifactId>-<version>.<packaging>
Maven will run with sensible defaults, so you can get right into it. However, if you are operating under a restricted environment or behind a firewall, you might need to prepare to run Maven, as it requires write access to the home directory (~/.m2 on Unix/Mac OS X and C:\Documents and Settings\username\.m2 on Windows) and network access to download binary dependencies.
to install the artifact (the JAR file) you've generated into your local repository.
Use
mvn eclipse:eclipse
to generate an Eclipse descriptor
Use mvn help:effective-pom
(mvn help:effective-pom -Doutput=wpom.xml)
see a much larger POM which exposes the default settings of Maven for debug.
Use mvn dependency:resolve
to find out what is on the classpath
plugin is bound to the surefire:test bound to the
The standard for a Maven repository is to store an artifact in the following directory relative to the root of the repository:
/<groupId>/<artifactId>/<version>/<artifactId>-<version>.<packaging>
Maven will run with sensible defaults, so you can get right into it. However, if you are operating under a restricted environment or behind a firewall, you might need to prepare to run Maven, as it requires write access to the home directory (~/.m2 on Unix/Mac OS X and C:\Documents and Settings\username\.m2 on Windows) and network access to download binary dependencies.
The location of your local repository can be changed in your user configuration (M2_HOME/conf/settings.xml). The default value is ${user.home}/.m2/repository/.
<settings> ... <localRepository>/path/to/local/repo/</localRepository> ... </settings>
Note: The local repository must be an absolute path.
Use
mvn installto install the artifact (the JAR file) you've generated into your local repository.
Use
mvn eclipse:eclipse
to generate an Eclipse descriptor
Use mvn help:effective-pom
(mvn help:effective-pom -Doutput=wpom.xml)
see a much larger POM which exposes the default settings of Maven for debug.
Use mvn dependency:resolve
mvn dependency:tree
to find out what is on the classpath
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main \ -Dexec.args="70112"
For a full description of the Exec plugin, run:
$ mvn help:describe -Dplugin=exec -Dfull
A test
-scoped dependency is a dependency that is available on the classpath only during test compilation and test execution.
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
resources:resources
process-resources
phase. This goal copies all of the resources from src/main/resources and any other configured resource directories to the output directory.test
phase. This goal executes all of the tests and creates output files that capture detailed results. By default, this goal will terminate a build if there is a test failure.
No comments:
Post a Comment