首页 > 代码库 > maven打包classes为jar
maven打包classes为jar
<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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。