首页 > 其他 > 详细

maven打包classes为jar

时间:2014-09-22 13:30:03      阅读:249      评论:0      收藏:0      [点我收藏+]
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
                <executions>
                    <!-- 定义在prepare-package时将classes中的代码目录打成jar -->
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classesDirectory>${project.basedir}/target/classes</classesDirectory>
                            <finalName>${project.artifactId}</finalName>
                            <outputDirectory>${project.basedir}/target/${project.artifactId}-${project.version}/WEB-INF/lib</outputDirectory>
                            <includes>
                                <include>com/**</include>
                                <include>struts2InAction/**</include>
                                <include>thinkingInJava/**</include>
                            </includes>
                        </configuration>
                    </execution>
                    <!-- 定义execution,设置id为 default-jar,同默认配置的id,在package时过滤掉classes的部分目录 -->
                    <!-- 
                    <execution>
                        <id>default-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classesDirectory>${project.basedir}/target/classes</classesDirectory>
                            <excludes>
                                <exclude>com/</exclude>
                                <exclude>struts2InAction/</exclude>
                                <exclude>thinkingInJava/</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                     -->
                </executions>
            </plugin>

 

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <!-- http://maven.apache.org/plugins/maven-war-plugin/faq.html#attached -->
                    <archiveClasses>true</archiveClasses>
                    <!--
                    <packagingExcludes>
                        WEB-INF/lib/commons-logging-*.jar,
                        %regex[WEB-INF/lib/log4j-(?!over-slf4j).*.jar]
                      </packagingExcludes>
                     -->
                </configuration>
            </plugin>

 

maven打包classes为jar

原文:http://www.cnblogs.com/wucg/p/3985791.html

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