Details
Description
The DbUnit, Hibernate3 and SQL Maven 2 Plugins have a "skip" configuration element that can be set to true in order to skip execution. This is a nice feature because it allows you pass in -Dmaven.test.skip=true and skip execution by adding the following in your pom.xml.
<configuration>
...
<skip>$
</skip>
</configuration>
Issue Links
- is related to
-
CARGO-696
Run Cargo on a Parent POM
-
Activity
Sure, that's possible, but I believe it's easier for users to understand the <skip> configuration element. We've got 3 plugins to add it already - and when they're related to testing I think it's important. It should be possible to skip any testing-related plugin executions IMO. We're going whole hog on Maven 2.0 for AppFuse 2.0 and many folks are skeptical about making the move. Telling them to add a property (actually we'll do it for them) vs. create a profile can be a bit overwhelming if you're new to Maven 2. Of course, if you're willing to show me a re-written version of one of our pom's with this profile, I might think different:
Matt, for the record I'm not against adding a skip element, I just want to understand why it's absolutely needed and why it would make cargo easier to use (I always tend to ensure there's only one way of doing things as much as possible).
I've checked your POM file and it seems you are already using a profile so I think the only thing you have to do is transform the activation section so that it's executed when a property doesn't exist. For example:
<activation>
<property>
<name>!maven.test.skip</name>
</property>
</activation>
That said I tested it quickly and couldn't make it to work. No idea why.
If you could make this work, would you be happy with it or do you still think it would be easier to users not to have to create a profile. The main downside I can see with the profile is that it takes more lines to write rather than a simple property to add.
BTW Cargo is NOT a testing plugin so skipping could make sense but so would it for any existing plugin. As a consequence a plugin skip property would make sense inside Maven's core. However I believe the chosen way so far for doing this are profiles... Hence my questions... ![]()
Thanks
-Vincent
<quote>That said I tested it quickly and couldn't make it to work. No idea why.</quote>
If you can't make it work - I doubt I'll have much better luck. ![]()
I agree that having "skip" as an option in the core plugin framework would be nice.
I got Unable to render embedded object: File (maven.test.skip to work - thanks) not found.
<profiles>
<profile>
<id>$
<activation>
<property>
<name>!maven.test.skip</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>0.2</version>
<configuration>
<wait>${cargo.wait}</wait>
<container>
<containerId>${cargo.container}
</containerId>
<!--home>$
</home-->
<zipUrlInstaller>
<url>$
</url>
<installDir>$
</installDir>
</zipUrlInstaller>
</container>
<configuration>
<home>$
/$
{cargo.container}/container</home>
<properties>
<cargo.hostname>$
<cargo.servlet.port>${cargo.port}</cargo.servlet.port>
</properties>
</configuration>
</configuration>
<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>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<configuration>
<tasks>
<taskdef resource="webtest_base_relaxed.taskdef">
<classpath refid="maven.test.classpath"></classpath>
</taskdef>
<mkdir dir="target/webtest-data"></mkdir>
<!-- Delete old results file if it exists -->
<delete file="target/webtest-data/web-tests-result.xml"></delete>
<!-- This is so the default will be used if no test case is specified -->
<property name="test" value="run-all-tests"></property>
<echo level="info">Testing '${project.build.finalName}' with locale '${user.language}'</echo>
<ant antfile="src/test/resources/web-tests.xml" target="${test}">
<property name="user.language" value="${user.language}"></property>
<property name="webapp.name" value="${project.build.finalName}"></property>
<property name="host" value="${cargo.host}
"></property>
<property name="port" value="$
"></property>
</ant>
</tasks>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.canoo</groupId>
<artifactId>webtest</artifactId>
<version>$
</version>
<exclusions>
<exclusion>
<groupId>javax.xml</groupId>
<artifactId>jsr173</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>$
</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>$
</version>
</dependency>
<dependency>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
<version>$
</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Hi,
maybe I can add a use case where using a profile is not enough (or someone could tell me how do it).
I have three profiles that are related with deployment environment: development, ci, and production. I'd like to activate cargo when the development and ci profiles are active, but not when the production one is active.
What I'd like to do is to define cargo in its own profile and in the other ones define a property to decide if it should be skipped (or define cargo in the main build, and use the aforementioned property to control its execution). Otherwise I need to define the cargo profile with an activation that is conjunction of the other activation rules.
So, having a skip property for cargo would definitely help.
Best,
Riccardo.
Any chance of getting this added? I've found I'm in need of this to skip Cargo from running when -DskipTests is passed in. I can put everything in a profile, but I'm only able to active one profile in my pom at a time.
Skip parameter implemented in r2426. Either configure in plugin configuration or through system property cargo.maven.skip. skipTests property is NOT used!
We are now wrapping up for the 1.0.3 release. It will be released soon! Please check the dev list for progress.
Hi Matt,
What advantage do you see over a profile triggered by the maven.test.skip property (this is the canonical way of doing it with m2 I believe)?
Thanks
-Vincent