eclipse maven 导出可执行jar

1,首先pom文件中加入配置

<build>
      <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>com.xxx.Mainclass</mainClass>  
                </manifest>  
            </archive>  
        </configuration>  
      </plugin>
     </plugins> 
  </build>

2,导出依赖jars

maven 执行命令 dependency:copy-dependencies -DoutputDirectory=target/lib 即可把所有依赖jar包导出至target/lib目录下

 

posted @ 2016-03-07 13:57  china2k  阅读(1183)  评论(0编辑  收藏  举报