Maven专题

开始学习http://maven.apache.org/guides/getting-started/index.html

這兩篇是必須要明白的
understand build lifecycle
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
understand pom
http://maven.apache.org/pom.html

1. 如何配置和使用plugin
plugin list http://maven.apache.org/plugins/
configure plugin http://maven.apache.org/guides/mini/guide-configuring-plugins.html
reference
https://cwiki.apache.org/MAVEN/maven-3x-and-site-plugin.html
2. 配置repository
下载:
local repository在user/.m2/repository 目录下。可以在下面建settings.xml 来引入多个repository. 这里引入的repository我猜是用来下载用的。
<repositories>
<repository>
<id>argus-build</id>    <url>http://maven/nexus/content/groups/build</url>
<releases>
<checksumPolicy>fail</checksumPolicy>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>

发布:
配置本地发布的repository信息,server下可配置包括svn等多种server的信息。
<servers>
<server>
<id>local-snapshot</id>
<username>z78918</username>
<password>*****</password>
</server>
<server>
<id>svn</id>
<username>z78918</username>
<password>Vision@11
</password>
</server>
</servers>

在pom里声明使用哪种server,
<distributionManagement>
<repository>
       <id>local-release</id>
       <url>http://localhost:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
    <id>local-snapshot</id>
        <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
  </distributionManagement>

在build里声明dav和scp协议
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>1.0-beta-7</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
</build>

3. site
参考
http://maven.apache.org/plugins/maven-site-plugin/examples/creating-content.html
和maven 3.0公用的site-plugin,经过实验只有3.0-beta-1
配置如下
<plugins>
  <plugin>
  <artifactId>maven-site-plugin</artifactId>
  <version>3.0-beta-1</version>
  <configuration>
         <locales>en</locales>
         <reportPlugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
              <version>2.4</version>
              <configuration>
                <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-javadoc-plugin</artifactId>
              <version>2.8</version>
            </plugin>
          </reportPlugins>
        </configuration>
  </plugin>
  </plugins>


Appendix A
Maven project descriptor
http://maven.apache.org/ref/3.0.3/maven-model/maven.html#class_DependencyManagement
All the scope description
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
FAQ
http://docs.codehaus.org/display/MAVENUSER/FAQs-1

你可能感兴趣的:(maven)