maven之plugin

发布
clean deploy

设置pom

<distributionManagement>
<repository>
<id>user-release</id>
<name>user release resp</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>

<snapshotRepository>
<id>user-snapshot</id>
<name>user snapshot</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>



</snapshotRepository>


</distributionManagement>
2查看用户权限
<securety-->user
3设置用户setting
    <server>
      <id>user-release</id>
      <username>deployment</username>
      <password>deployment123</password>
    </server>
<server>
      <id>user-snapshots</id>
      <username>deployment</username>
      <password>deployment123</password>
    </server>
设置权限release repositories ->configuration->access setting ->allow reploy
clean deloy

创建一个cms snapshot ->add->repositoriesid cms-snapshot;repositoriesname :cms-snapshot,deploy police allow reploy->save
添加权限
privileges->add ->name:cmsprivilege,desc:cmsprivilege:repository设权限的工厂reposity target:all(maven2)
添加角色
roles->add->nexus role->roleid:cms-role name:cms-role add filter cms
创建角色
useradd->nexus role->status :active add:role->save

maven的生命周期
1.clean三个步骤preclean clean post clean
2.compile
validate
generate-sources
process-sources
generate-resources
process-resources     复制并处理资源文件,至目标目录,准备打包。
compile     编译项目的源代码。
process-classes
generate-test-sources
process-test-sources
generate-test-resources
process-test-resources     复制并处理资源文件,至目标测试目录。
test-compile     编译测试源代码。
process-test-classes
test     使用合适的单元测试框架运行测试。这些测试代码不会被打包或部署。
prepare-package
package     接受编译好的代码,打包成可发布的格式,如 JAR 。
pre-integration-test
integration-test
post-integration-test
verify
install     将包安装至本地仓库,以让其它项目依赖。
deploy     将最终的包复制到远程的仓库,以让其它开发人员与项目共享

3.site

maven插件
http://maven.apache.org/plugins/maven-compiler-plugin/source-repository.html
http://svn.apache.org/repos/asf/maven/plugins/tags/maven-compiler-plugin-3.5
http://maven.apache.org/components/plugins/maven-source-plugin/
http://maven.apache.org/plugins/index.html
->example

build>
<pluginManagement>
<plugins>
 <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.4</version>
        <executions>
        <execution>
        
        <phase>compile</phase>
        <goals>
        <goal>jar</goal>
        <goal>test-jar</goal>
        
        </goals>
        
        </execution>
        
        
        </executions>
      </plugin>


</plugins>

</pluginManagement>


</build>
run as package顺序compile 上面的插件,package->生成目标文件

仓库和插件的生命周期
本地仓库。私有仓库,中央仓库

clean source:jar


测试
以运行
Test**
**Test
**TestCase

你可能感兴趣的:(maven之plugin)