maven3 添加插件的方法

时间:2015-07-08 10:48:10   收藏:0   阅读:109

在maven中添加插件通过修改项目下的pom.xml文件完成。

如下是配置第一个插件示例:

(这个插件主要功能是为maven项目指定一个main方法。)

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.zte.app.myapp.App</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

 

如果过程中出现:cvc-complex-type.2.4.a: Invalid content was found starting with element xxxx

之类的错误,一般都是拼写问题,或者元素嵌套有误。

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!