首页 > 其他 > 详细

maven 几个插件的使用

时间:2016-10-13 21:38:59      阅读:202      评论:0      收藏:0      [点我收藏+]

1.  compile 

 <plugin> 
              <artifactId>maven-compiler-plugin</artifactId> 
              <configuration> 
                  <source>1.6</source> 
                  <target>1.6</target> 
                  <encoding>UTF-8</encoding> 
                  <compilerArguments> 
                   <extdirs>lib/</extdirs>   //  三方jar 包编译配置
                 </compilerArguments> 
              </configuration> 
            </plugin>

  

2.  依赖打包

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>prepare-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>

  

3. 可执行jar 包

    

 <build>  
        <finalName>image</finalName>  
        <plugins>  
            <plugin>  
                <groupId>org.apache.maven.plugins</groupId>  
                <artifactId>maven-jar-plugin</artifactId>  
                <version>2.4</version>  
                <configuration>  
                    <archive>  
                        <manifest>  
                            <addClasspath>true</addClasspath>  
                            <classpathPrefix>lib/</classpathPrefix>  
                            <mainClass>image_handle.App</mainClass>  
                        </manifest>  
                    </archive>  
                </configuration>  
            </plugin>  
        </plugins>  
    </build>

  

4.  另一个包含依赖

     

<plugins>  
            <plugin>  
                <artifactId>maven-assembly-plugin</artifactId>  
                <configuration>  
                    <archive>  
                        <manifest>  
                            <mainClass>com.allen.capturewebdata.Main</mainClass>  
                        </manifest>  
                    </archive>  
                    <descriptorRefs>  
                        <descriptorRef>jar-with-dependencies</descriptorRef>  
                    </descriptorRefs>  
                </configuration>  
            </plugin>  
        </plugins>

  

maven 几个插件的使用

原文:http://www.cnblogs.com/rongfengliang/p/5958086.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!