maven怎么配置使打的war包能够包含pom中所有依赖的jar?

ToSun 发布于 2013/12/22 23:49
阅读 5K+
收藏 0

工程B使用maven打成了一个jar包,B的pom文件依赖了一些jar包,这些jar包没有被打入B.jar;

工程A的pom文件中依赖B.jar,然后使用的maven4eclipse插件,在eclipse中可以冲工程A的maven dependencies中看到已经包含了A.pom和B.pom.xml中的所有的jar包了。但是将工程A使用maven打成war包后,lib目录中却没有B依赖的jar包,这是为什么呢?

<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>unpack-ui-plugins</id>
						<goals>
							<goal>unpack-dependencies</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<outputDirectory>${project.build.directory}/generated-resources/hqu</outputDirectory>
							<includeGroupIds>org.hyperic.hq.uiplugin,org.hyperic.hq.hqapi</includeGroupIds>
							<excludeTransitive>true</excludeTransitive>
						</configuration>
					</execution>
					<execution>
						<id>copy-plugins</id>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<outputDirectory>${project.build.directory}/generated-resources/WEB-INF/hq-plugins</outputDirectory>
							<includeGroupIds>org.hyperic.hq.plugin</includeGroupIds>
							<excludeTransitive>true</excludeTransitive>
							<includeTypes>jar</includeTypes>
							<stripVersion>true</stripVersion>
						</configuration>	
					</execution>
					<execution>
						<id>unpack-plugins</id>
						<goals>
							<goal>unpack-dependencies</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<outputDirectory>${project.build.directory}/generated-resources/WEB-INF/hq-plugins</outputDirectory>
							<includeGroupIds>org.hyperic.hq.plugin</includeGroupIds>
							<excludeTransitive>true</excludeTransitive>
							<includeTypes>zip</includeTypes>
							<stripVersion>true</stripVersion>
						</configuration>
					</execution>
					<execution>
						<id>unpack-sigar</id>
						<goals>
							<goal>unpack-dependencies</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<outputDirectory>${project.build.directory}/generated-resources/WEB-INF/lib</outputDirectory>
							<includeGroupIds>org.hyperic</includeGroupIds>
							<includeArtifactIds>sigar</includeArtifactIds>
							<excludeTransitive>true</excludeTransitive>
							<includeTypes>zip</includeTypes>
							<stripVersion>true</stripVersion>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<warName>ROOT</warName>
					<webResources>
						<resource>
							<directory>${project.build.directory}/generated-resources</directory>
						</resource>
					</webResources>
				</configuration>
			</plugin>
			<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                    	<goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>tomcat-maven-plugin</artifactId>
			</plugin>
				<plugin>
					<groupId>com.atlassian.maven.plugins</groupId>
					<artifactId>maven-clover2-plugin</artifactId>
					<version>${clover2.version}</version>
					<configuration>
							<skip>true</skip>
					</configuration>
				</plugin>
				
		</plugins>
	</build>



求教了,原因是最开始A打成的war包包含B依赖的jar包,可以正常运行;

但是我像A和B的pom中添加了两个依赖后,重新对A和B进行打包,就出现这样的问题了。

加载中
0
错觉
错觉
没法看 你弄的太乱了,先美化下再来问吧
返回顶部
顶部