maven之cargo配置


1.在maven 的setting.xml中配置groupId因为cargo插件不是官方自带的

 <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
    <pluginGroup>org.codehaus.cargo</pluginGroup>
  </pluginGroups>


2.在pom.xml中配置cargo插件

<plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.remote.username>admin</cargo.remote.username>
                            <cargo.remote.password>admin</cargo.remote.password>
                            <cargo.remote.manager.url>http://localhost:8080/manager</cargo.remote.manager.url>
                        </properties>
                    </configuration>
                </configuration>
            </plugin>

3.tomcat的tomcat-users.xml中配置管理员密码

<tomcat-users>
<role rolename="manager"/>
 <user username="admin" password="admin" roles="manager"/>
</tomcat-users>


4.启动tomcat


5.使用命令mvn cargo:redeploy


注意第五步测试下看看能不能打包mvn clean package如果是编译出错的话

可以看看是否是资源文件没有配置编码的问题

<!-- resource插件, 设定编码 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>

如果是project configuration is not update-to-date with pom.xml

参照http://hi.baidu.com/javalovers/item/5086e912dce1aa6870d5e87e

 或者重新配置下jdk的版本




猜你喜欢

转载自labreeze.iteye.com/blog/1663021
今日推荐