首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

maven 封装可执行jar的方法

2013-10-19 
maven 打包可执行jar的方法http://sundful.iteye.com/blog/18500701.修改pom.xml增加如下内容 buildres

maven 打包可执行jar的方法
http://sundful.iteye.com/blog/1850070
1.修改pom.xml增加如下内容

<build>      <resources>          <resource>              <targetPath>${project.build.directory}/classes</targetPath>              <directory>src/main/resources</directory>              <filtering>true</filtering>              <includes>                  <include>**/*.xml</include>              </includes>          </resource>      </resources>      <plugins>          <plugin>              <groupId>org.apache.maven.plugins</groupId>              <artifactId>maven-compiler-plugin</artifactId>              <version>3.0</version>              <configuration>                  <source>1.6</source>                  <target>1.6</target>                  <encoding>UTF-8</encoding>              </configuration>          </plugin>          <plugin>              <groupId>org.apache.maven.plugins</groupId>              <artifactId>maven-shade-plugin</artifactId>              <version>2.0</version>              <executions>                  <execution>                      <phase>package</phase>                      <goals>                          <goal>shade</goal>                      </goals>                      <configuration>                          <transformers>                              <transformer                                  implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">                                  <mainClass>com.test.testguava.app.App</mainClass>                              </transformer>                              <transformer                                  implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">                                  <resource>applicationContext.xml</resource>                              </transformer>                          </transformers>                          <shadedArtifactAttached>true</shadedArtifactAttached>                          <shadedClassifierName>executable</shadedClassifierName>                      </configuration>                  </execution>              </executions>          </plugin>      </plugins>  </build>  

热点排行