Maven Pofile 打war包时排除某个jar

Maven Pofile 打war包时排除某个jar

参考:http://stackoverflow.com/questions/13819558/maven-profile-removing-dependency

反过来想,激活某个profile时将该jar添加进dependencies

比如:持续集成时(profile ci),需要使用某一个Jar,但发布生产时(profile prod),需要将该jar排除

<profiles>

    <profile>
        <id>ci</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <dependencies>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.14</version>
            </dependency>
        </dependencies>
    </profile>

    <profile>
        <id>prod</id>
        <dependencies>
        </dependencies>
    </profile>

</profiles>

猜你喜欢

转载自crabdave.iteye.com/blog/2361283