Maven工程打包时动态设置war包目录

pom.xml中加入插件并设置属性;

 <build>
        <plugins>

            <plugin>    
                <groupId>org.apache.maven.plugins</groupId>    
                <artifactId>maven-dependency-plugin</artifactId>    
                <version>2.8</version>    
                <executions>    
                    <execution>    
                        <id>copy-war</id>    
                        <phase>package</phase>    
                        <goals>    
                            <goal>copy</goal>    
                        </goals>    
                        <configuration>    
                            <artifactItems>    
                                <artifactItem>    
                                    <groupId>${project.groupId}</groupId>    
                                    <artifactId>${project.artifactId}</artifactId>    
                                    <version>${project.version}</version>    
                                    <type>${project.packaging}</type>    
                                </artifactItem>    
                            </artifactItems>    
                            <!--指定war包保存地址-->  
                            <outputDirectory>F:\server\apache-tomcat-8.0.42\webapps</outputDirectory>
                            <includeArtifactIds>false</includeArtifactIds>

                        </configuration>    
                    </execution>    
                </executions>
            </plugin>



        </plugins>
    </build>

猜你喜欢

转载自blog.csdn.net/lnview/article/details/75517314