Cargo maven plugin - start goal ignores configuration, “run” works fine

非 Y 不嫁゛ 提交于 2019-12-11 12:26:29

问题


I want cargo maven plugin to start a Tomcat7 so i put into my pom:

            <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.2.0</version>
            <!-- minimal configuration to let adb run (mvn package org.codehaus.cargo:cargo-maven2-plugin:run) in a local tomcat -->
            <configuration>
                <containerId>tomcat7x</containerId>
                <containerUrl>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip
                </containerUrl>
                <configuration>
                    <properties>
                        <cargo.servlet.port>1718</cargo.servlet.port>
                    </properties>
                </configuration>
            </configuration>
        </plugin>

The Problem is if i run:

mvn package org.codehaus.cargo:cargo-maven2-plugin:run

all is working fine but if i run

mvn package org.codehaus.cargo:cargo-maven2-plugin:start

the configuration set in pom is beeing ignored:"No container defined, using a default [jetty6x, embedded] container"

you can reproduce this easily. just create an war-maven app:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webappp

Then add the code above to pom and run both commands.

So how to set ContainerId and Url properly for goal start -- Am I missing something?!


回答1:


so i contacted cargo support. the configuration above works indeed only with run goal, but there is also a configuration that works with both (the cargo doc is somehow misguiding):

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.2.0</version>
    <!-- minimal configuration to let adb run (mvn package org.codehaus.cargo:cargo-maven2-plugin:run) in a local tomcat -->
    <configuration>
      <container>
        <containerId>tomcat7x</containerId>
        <zipUrlInstaller>
          <url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip</url>
        </zipUrlInstaller>
      </container>
      <configuration>
        <properties>
          <cargo.servlet.port>1718</cargo.servlet.port>
        </properties>
      </configuration>
    </configuration>
  </plugin>

notice the additional container and zipUrlInstaller tag instead of containerUrl.



来源:https://stackoverflow.com/questions/9079813/cargo-maven-plugin-start-goal-ignores-configuration-run-works-fine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!