maven3常用命令及eclipse插件地址

来源:互联网 发布:离线地图标注软件 编辑:程序博客网 时间:2024/06/06 16:18
maven常用命令
常用命令为 :
    mvn archetype:create :创建 Maven 项目
    mvn compile :编译源代码
    mvn test-compile :编译测试代码
    mvn test : 运行应用程序中的单元测试
    mvn site : 生成项目相关信息的网站
    mvn clean :清除目标目录中的生成结果
    mvn package : 依据项目生成 jar 文件
    mvn install :在本地 Repository 中安装 jar(mvn install -D maven.test.skip=true 跳过TestCase检验,否则在install时会运行TestCase测试)
    mvn deploy:将jar包发布到远程仓库

    mvn eclipse:eclipse :生成 Eclipse 项目文件

    mvn assembly:assembly  : 将依赖jar包打入 jar包

生成项目
   建一个 JAVA 项目 : mvn archetype:create -DgroupId=com.test -DartifactId=App

   建一个 web 项目 : mvn archetype:create -DgroupId=com.test -DartifactId=web-app -DarchetypeArtifactId=maven-archetype-webapp


eclipse插件地址为:

http://m2eclipse.sonatype.org/sites/m2e

修改mvn package默认地址

如果出现 Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war  将openjdk换成sun jdk

  <build>
    <plugins>    

         <!-- 更改maven默认的打包目录 -->
        <plugin>
           <artifactId>maven-war-plugin</artifactId>
           <configuration>
               <webappDirectory>${basedir}/src/main/webapp</webappDirectory>
               <warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
           </configuration>
       </plugin>      
    </plugins>
  </build>



    mvn assembly:assembly  : 将依赖jar包打入 jar包

<plugin>
<!-- NOTE: We don't need a groupId specification because the group is 
org.apache.maven.plugins ...which is assumed by default. -->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>


原创粉丝点击