MAVEN插件积累

maven经常使用插件及目标java

mvn help:system   查看系统变量apache

mvn help:effective-pom  最终生效的pom文件内容bootstrap

mvn help:describe -Dplugin=clean 查看Plugin的功能服务器

mvn help:describe -Dcmd=deploy 查看deploy阶段的设定详细app

mvn dependency:tree 查看项目的依赖关系maven

mvn dependency:analyze 分析项目的依赖关系ui

mvn dependency:build-classpath  查看classpath的内容url

mvn scm:updatespa




<build>.net

      

<resources>

            <resource>

                <directory>src/main/java/com/atm/haservice/sys/mapping</directory>

                <includes>

                    <include>*</include>

                </includes>

                <targetPath>com/atm/haservice/sys/mapping</targetPath>

            </resource>

            <resource>

                <directory>src/main/resources</directory>

                <excludes>

                    <exclude>generatorConfig.xml</exclude>

                </excludes>

            </resource>

        </resources>

        <plugins>

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-jar-plugin</artifactId>

                <configuration>

                    <archive>

                        <manifest>

                            <mainClass>cn.com.demo.Main</mainClass>

                            <addClasspath>true</addClasspath>

                        </manifest>

                    </archive>

                </configuration>

            </plugin>

           

<plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-dependency-plugin</artifactId>

                <version>2.1</version>

                <executions>

                    <execution>

                        <id>copy-dependencies</id>

                        <phase>package</phase>

                        <goals>

                            <goal>copy-dependencies</goal>

                        </goals>

                        <configuration>

                            <outputDirectory>${project.build.directory}/lib</outputDirectory>

                            <overWriteReleases>false</overWriteReleases>

                            <overWriteSnapshots>false</overWriteSnapshots>

                            <overWriteIfNewer>true</overWriteIfNewer>

                        </configuration>

                    </execution>

                </executions>

            </plugin>

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-assembly-plugin</artifactId>

                <configuration>

                    <descriptorRefs>

                        <descriptorRef>jar-with-dependencies</descriptorRef>

                    </descriptorRefs>

                </configuration>

            </plugin>

        </plugins>

    </build>

发布到企业内部的nexus服务器

在~/.m2/setting.xml中设定服务器的认证情报

<server>  

      <id>nexus-releases</id>  

      <username>admin</username>  

      <password>admin123</password>  

    </server>  

    <server>  

      <id>nexus-snapshots</id>  

      <username>admin</username>  

      <password>admin123</password>  

    </server>

2,在项目的pom.xml中陪在发布元素

<distributionManagement>

        <repository>

            <id>nexus-releases</id>

            <name>Nexus Release Repository</name>

            <url>http://localhost:8081/nexus/content/repositories/releases/</url>

         <!--

          <url>scp://localhost:8081/nexus/content/repositories/releases/</url>

        -->

        </repository>

        <snapshotRepository>

            <id>nexus-snapshots</id>

            <name>Nexus Snapshot Repository</name>

            <url>http://127.0.0.1:8081/nexus/content/repositories/snapshots/</url>

        </snapshotRepository>

    </distributionManagement>

3)执行mvn deploy

配置maven首先从公司内部的nexus下载组件

1)在~/.m2/setting.xml中配置mirrior内容,由于maven默认从远程的central获取组件,

经过在setting中陪在mirror到nexus-public,因此首先会从nexus的仓库获取组件,无需在pom.xml文件中配置内容。

但若是要下载snapshot的内容,就得陪在profiles来进行查询,应为maven默认不会查询snapshot的。

<mirrors>

    <mirror>

      <id>nexus-public</id>

      <mirrorOf>central</mirrorOf>

      <name>nexus-public-for-central</name>

      <url>http://localhost:8081/nexus/content/groups/public/</url>

    </mirror>

  </mirrors>

maven代码管理(SVN)操做

scm:branch - branch the project(建立项目的分支)
scm:validate - validate the scm information in the pom(校验SCM的配置信息)
scm:add - command to add file(增长一个文件)
scm:unedit - command to stop editing the working copy(中止编辑当前COPY)
scm:export - command to get a fresh exported copy(拉一个全新的分支)
scm:bootstrap - command to checkout and build a project(checkout并编译工程)
scm:changelog - command to show the source code revisions(显示源码版本)
scm:list - command for get the list of project files(列出工程的文件)
scm:checkin - command for commiting changes(提交变动)
scm:checkout - command for getting the source code(获取源码)
scm:status - command for showing the scm status of the working copy(获取本地项目的状态)
scm:update - command for updating the working copy with the latest changes(从服务器获取最新的版本)
scm:diff - command for showing the difference of the working copy with the remote one(比较本地与远程服务器的差别)
scm:update-subprojects - command for updating all projects in a multi project build(更新子项目)
scm:edit - command for starting edit on the working copy(编辑)
scm:tag - command for tagging a certain revision(打标签)
相关文章
相关标签/搜索