码迷,mamicode.com
首页 > 其他好文 > 详细

maven3 添加插件的方法

时间:2015-07-08 10:48:10      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:

在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

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

 

maven3 添加插件的方法

标签:

原文地址:http://www.cnblogs.com/bigdatapark/p/4629446.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!