1. 程式人生 > >利用maven在一個專案中同時打war包和jar包

利用maven在一個專案中同時打war包和jar包

把專案的打包型別設定稱war

<packaging>war</packaging>

然後新增:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.2</version>
    <executions>
        <execution>
            <id
>
make-a-jar</id> <phase>compile</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> <configuration> ... </configuration> </plugin>

以及:

<plugin
>
<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> ... </configuration> </plugin>