maven

others

PMD plugin 代码检查插件

三大生命周期 clean default site 各自独立,各包含若干阶段。


maven

For every Apache Maven project, regardless of the packaging type,the default build lifecycle
is applied and the build is automated. As we just witnessed, the default build lifecycle consists
of phases that can be executed from the command-line terminal.
These phases are:
ff Validate: Validates that all project information is available and correct
ff Compile: Compiles the source code
ff Test: Runs unit tests within a suitable framework
ff Package: Packages the compiled code in its distribution format
ff Integration-test: Processes the package in the integration test environment
ff Verify: Runs checks to verify if the package is valid
ff Install: Installs the package in the local repository
ff Deploy: Installs the final package in a remote repository
Each of the build lifecycle phases is a Maven plugin. We will have a detailed look at Apache
Maven plugins in Chapter 9, Extending Apache Maven. When you execute them for the
first time, Apache Maven will download the plugin from the default online Maven Central
Repository that can be found at http:// repo1.maven.org/maven2 and will install
it in your local Apache Maven repository.


Maven dependencies have six possible scopes:
ff Compile: This is the default scope. Compile dependencies are available in
the classpaths.
ff Provided: This scope assumes that the JDK or the environment provides
dependencies at runtime.
ff Runtime: Dependencies that are required at runtime and are specified in the
runtime classpaths.
ff Test: Dependencies required for test compilation and execution.
ff System: Dependency is always available, but the JAR is provided nonetheless.
ff Import: Imports dependencies specified in POM included via the
<dependencyManagement/> element.

The dependency plugin provides the capability to manipulate artifacts. It can copy
and/or unpack artifacts from local or remote repositories to a specified location."

<dependencies>
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<scope>...</scope>
</dependency>
</dependencies>

System dependencies are not looked for in the repository. For them, we need to specify the
path to the JAR:
<dependencies>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>

你可能感兴趣的:(maven)