Maven包成功但无法在WEB-INF / lib中找到一些Jar

时间:2014-03-23 02:59:47

标签: maven jar package

<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <optional>true</optional>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <optional>true</optional>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <warName>${project.artifactId}</warName>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.4</version>
                </plugin>

然后运行&#34; mvn package&#34;,所有成功并创建一个test.war。 但后来我打开test.war找不到一些重要的jar。 这些罐子可以在当地的Maven Path中找到,但不能在战争中打包。

缺乏jar如下:

spring-aop-3.2.5.RELEASE.jar
spring-beans-3.2.5.RELEASE.jar
spring-context-3.2.5.RELEASE.jar
spring-core-3.2.5.RELEASE.jar
spring-expression-3.2.5.RELEASE.jar
spring-jms-3.2.5.RELEASE.jar
spring-webmvc-3.2.5.RELEASE.jar

Maven调试信息

[DEBUG] Processing: spring-core-3.2.5.RELEASE.jar
[DEBUG] Processing: spring-beans-3.2.5.RELEASE.jar
[DEBUG] Processing: spring-context-3.2.5.RELEASE.jar
[DEBUG] Processing: spring-expression-3.2.5.RELEASE.jar
[DEBUG] Processing: spring-aop-3.2.5.RELEASE.jar
[DEBUG] Processing: aopalliance-1.0.jar
[DEBUG]  + WEB-INF/lib/aopalliance-1.0.jar has been copied.
[DEBUG] Processing: spring-context-support-3.2.5.RELEASE.jar
[DEBUG]  + WEB-INF/lib/spring-context-support-3.2.5.RELEASE.jar has been copied.
[DEBUG] Processing: aspectjrt-1.7.4.jar
[DEBUG]  + WEB-INF/lib/aspectjrt-1.7.4.jar has been copied.
[DEBUG] Processing: aspectjweaver-1.7.4.jar
[DEBUG]  + WEB-INF/lib/aspectjweaver-1.7.4.jar has been copied.
[DEBUG] Processing: hibernate-entitymanager-4.2.8.Final.jar
[DEBUG]  + WEB-INF/lib/hibernate-entitymanager-4.2.8.Final.jar has been copied.
[DEBUG] Processing: jboss-logging-3.1.0.GA.jar
[DEBUG]  + WEB-INF/lib/jboss-logging-3.1.0.GA.jar has been copied.
[DEBUG] Processing: hibernate-core-4.2.8.Final.jar
[DEBUG]  + WEB-INF/lib/hibernate-core-4.2.8.Final.jar has been copied.
[DEBUG] Processing: antlr-2.7.7.jar
[DEBUG]  + WEB-INF/lib/antlr-2.7.7.jar has been copied.
[DEBUG] Processing: javassist-3.18.1-GA.jar
[DEBUG]  + WEB-INF/lib/javassist-3.18.1-GA.jar has been copied.
[DEBUG] Processing: jboss-transaction-api_1.1_spec-1.0.1.Final.jar
[DEBUG]  + WEB-INF/lib/jboss-transaction-api_1.1_spec-1.0.1.Final.jar has been copied.
[DEBUG] Processing: hibernate-jpa-2.0-api-1.0.1.Final.jar
[DEBUG]  + WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar has been copied.
[DEBUG] Processing: hibernate-commons-annotations-4.0.2.Final.jar
[DEBUG]  + WEB-INF/lib/hibernate-commons-annotations-4.0.2.Final.jar has been copied.
[DEBUG] Processing: hibernate-ehcache-4.2.8.Final.jar
[DEBUG]  + WEB-INF/lib/hibernate-ehcache-4.2.8.Final.jar has been copied.
[DEBUG] Processing: mybatis-3.2.3.jar
[DEBUG]  + WEB-INF/lib/mybatis-3.2.3.jar has been copied.
[DEBUG] Processing: mybatis-spring-1.2.1.jar
[DEBUG]  + WEB-INF/lib/mybatis-spring-1.2.1.jar has been copied.
[DEBUG] Processing: spring-data-jpa-1.4.3.RELEASE.jar
[DEBUG]  + WEB-INF/lib/spring-data-jpa-1.4.3.RELEASE.jar has been copied.
[DEBUG] Processing: spring-data-commons-1.6.3.RELEASE.jar
[DEBUG]  + WEB-INF/lib/spring-data-commons-1.6.3.RELEASE.jar has been copied.
[DEBUG] Processing: spring-orm-3.2.5.RELEASE.jar
[DEBUG]  + WEB-INF/lib/spring-orm-3.2.5.RELEASE.jar has been copied.
[DEBUG] Processing: spring-jdbc-3.2.5.RELEASE.jar
[DEBUG]  + WEB-INF/lib/spring-jdbc-3.2.5.RELEASE.jar has been copied.
[DEBUG] Processing: spring-tx-3.2.5.RELEASE.jar
[DEBUG]  + WEB-INF/lib/spring-tx-3.2.5.RELEASE.jar has been copied.
[DEBUG] Processing: spring-aspects-3.2.5.RELEASE.jar
[DEBUG]  + WEB-INF/lib/spring-aspects-3.2.5.RELEASE.jar has been copied.
[DEBUG] Processing: tomcat-jdbc-7.0.47.jar
[DEBUG]  + WEB-INF/lib/tomcat-jdbc-7.0.47.jar has been copied.
[DEBUG] Processing: tomcat-juli-7.0.47.jar
[DEBUG]  + WEB-INF/lib/tomcat-juli-7.0.47.jar has been copied.
[DEBUG] Processing: ojdbc6-11.2.0.1.0.jar
[DEBUG]  + WEB-INF/lib/ojdbc6-11.2.0.1.0.jar has been copied.
[DEBUG] Processing: spring-webmvc-3.2.5.RELEASE.jar
[DEBUG] Processing: spring-web-3.2.5.RELEASE.jar
[DEBUG]  + WEB-INF/lib/spring-web-3.2.5.RELEASE.jar has been copied.

1 个答案:

答案 0 :(得分:0)

您已将这些依赖项标记为optional,这意味着使用此工件的其他项目必须自行决定是否明确添加这些依赖项。它们似乎是必需的而不是可选的,因此删除该标记将解决您的问题。

相关问题