[maven] problem mit konfiguration von cargo plugin

dermoritz

Bekanntes Mitglied
Ich hab eine sehr komisches Problem mit dem Cargo Plugin: falls ich "run" ausführe wird meine gesetzte Konfiguration anstandslos benutzt. Bei "start" hingegen wird unter anderem "containerId" ignoriert.

im Detail sieht die Konfiguration wie folgt aus:
Code:
...
	<properties>
		<cargo.maven.containerId>tomcat7x</cargo.maven.containerId>
<cargo.maven.containerUrl>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.22/bin/apache-tomcat-7.0.22.zip</cargo.maven.containerUrl>
	</properties>
...
		<profile>
			<id>seleniumTest</id>
			<activation>
				<property>
					<!-- only active if set to true -->
					<name>activateSelenium</name>
					<value>true</value>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.cargo</groupId>
						<artifactId>cargo-maven2-plugin</artifactId>
						<executions>
							<execution>
								<id>start-container</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>start</goal>
								</goals>
							</execution>
							<execution>
								<id>stop-container</id>
								<phase>post-integration-test</phase>
								<goals>
									<goal>stop</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
...
                                <plugin>
				<groupId>org.codehaus.cargo</groupId>
				<artifactId>cargo-maven2-plugin</artifactId>
				<version>1.1.4</version>
				<configuration>
					
					<configuration>
						<properties>
							<cargo.servlet.port>1718</cargo.servlet.port>
						</properties>
					</configuration>
				</configuration>
			</plugin>

Wie gesagt oben ist das goal auf "start" gestellt - in diesem Fall wird die Property für containerId ignoriert. ->"No container defined, using a default [jetty6x, embedded] container"
Sobald ich das goal auf "run" stelle wird tomcat7x verwendet und alles ist gut. Hat jemand eine Erklärung dafür? Was kann ich noch versuchen (-X hab ich versucht, es zeigt nur, dass containerId gesetzt wurde, cargo igoriert das eben in dem einen Fall und in dem anderen nicht).

Danke im Voraus
 
es ist wirklich zum mäusemelken. das problem ist viel "einfacher":
pom:
Code:
<plugin>
				<groupId>org.codehaus.cargo</groupId>
				<artifactId>cargo-maven2-plugin</artifactId>
				<version>1.1.4</version>
				<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>

mvn clean verify org.codehaus.cargo:cargo-maven2-plugin:run --> alles gut
mvn clean verify org.codehaus.cargo:cargo-maven2-plugin:start --> "containerId" wird ignoriert (wahrscheinlich auch die url) aber der port wird korrekt gesetzt.

Ist das ein Bug oder bin ich zu blöd?
 
Hi,

was mir nicht klar ist die containerUrl ? Und warum Du cargo2 nochmal explizit auf der Command line angibst...?


Ich habe hier mal meine cargo2 konfiguration rangehängt die einfach per

Code:
mvn verify

gestartet wird...in einem eigenen it-module...

Code:
 <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <configuration>
          <wait>false</wait>
          <container>
            <containerId>tomcat${tomcat.major}x</containerId>
            <zipUrlInstaller>
              <url>http://archive.apache.org/dist/tomcat/tomcat-${tomcat.major}/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</url>
              <downloadDir>${project.build.directory}/downloads/</downloadDir>
              <extractDir>${project.build.directory}/installation</extractDir>
            </zipUrlInstaller>
            <output>${project.build.directory}/tomcat${tomcat.major}x.log</output>
            <log>${project.build.directory}/cargo.log</log>
          </container>
          <configuration>
            <home>${project.build.directory}/tomcat-${tomcat.version}/container</home>
            <properties>
              <cargo.logging>high</cargo.logging>
              <cargo.servlet.port>9080</cargo.servlet.port>
              <cargo.tomcat.ajp.port>9008</cargo.tomcat.ajp.port>
            </properties>
          </configuration>
        </configuration>
        <executions>
          <execution>
            <id>start-container</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <deployer>
                <deployables>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>www</artifactId>
                    <type>war</type>
                    <pingURL>http://localhost:9080/www</pingURL>
                    <pingTimeout>30000</pingTimeout>
                    <properties>
                      <context>www</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>
            </configuration>
          </execution>
          <execution>
            <id>stop-container</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

Gruß
Karl Heinz Marbaise
 
inzwischen hab ich es alles nochmals eingedampft:

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

in die pom
Code:
		<plugin>
				<groupId>org.codehaus.cargo</groupId>
				<artifactId>cargo-maven2-plugin</artifactId>
				<version>1.2.0</version>
				<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>
einfügen.
Ausführen:
mvn package cargo:run --> funktioniert benutzt tomcat 7 und falls noch nicht vorhanden wird er von der url heruntergeladen

mvn package cargo:start --> funktioniert nicht/Konfiguration wird ignoriert: "No container defined, using a default [jetty6x, embedded] container"

(letztendlich können damit alle meine post ignoriert werden - sie verwirrn nur ;-). nun weiß ich - es liegt nicht an dem speziellen Projekt.)

EDIT: habe den entscheidenden unterschied korrigiert cargo:run / cargo:start
 
Zuletzt bearbeitet:
ok ich habs, es gibt bei cargo tatsächlich eine Konfiguration die nur mit "run" läuft. Soll es mit beiden goals laufen muss es so aussehen:

Code:
		<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://a-inet01:8100/apache-tomcat-7.0.25.zip</url>
            </zipUrlInstaller>
          </container>
          <configuration>
            <properties>
              <cargo.servlet.port>1718</cargo.servlet.port>
            </properties>
          </configuration>
        </configuration>
      </plugin>

also das container setup muss unter "<container>" und die Url zur zip Datei gibt man nun mit zwei ebenen an.
(Das is das erste plugin das ich sehe bei dem man die gleichen Einstelleungen auf verschiedene Weise vornhemen kann und das ganze noch abhängig vom goal - das Problem hat mich 3 Tage gekosted 😛)
 

Neue Themen


Zurück
Oben