Cargo

Add a <skip> configuration element that allows you to skip plugin's execution

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.2-maven2
  • Fix Version/s: 1.0.3
  • Component/s: Maven2
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    0

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>${maven.test.skip}</skip>
</configuration>

Issue Links

Activity

Hide
Vincent Massol added a comment -

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

Show
Vincent Massol added a comment - 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
Hide
Matt Raible added a comment -

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:

https://appfuse.dev.java.net/source/browse/*checkout*/appfuse/trunk/archetypes/appfuse-basic-struts/pom.xml?content-type=text%2Fplain&rev=2313

Show
Matt Raible added a comment - 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: https://appfuse.dev.java.net/source/browse/*checkout*/appfuse/trunk/archetypes/appfuse-basic-struts/pom.xml?content-type=text%2Fplain&rev=2313
Hide
Vincent Massol added a comment -

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

Show
Vincent Massol added a comment - 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
Hide
Matt Raible added a comment -

<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.

Show
Matt Raible added a comment - <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.
Hide
Matt Raible added a comment -

I got Unable to render embedded object: File (maven.test.skip to work - thanks) not found.

<profiles>
<profile>
<id>${cargo.container}</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>${cargo.container.home}</home-->
<zipUrlInstaller>
<url>${cargo.container.url}</url>
<installDir>${installDir}</installDir>
</zipUrlInstaller>
</container>
<configuration>
<home>${project.build.directory}/${cargo.container}/container</home>
<properties>
<cargo.hostname>${cargo.host}</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="${cargo.port}"></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>${webtest.version}</version>
<exclusions>
<exclusion>
<groupId>javax.xml</groupId>
<artifactId>jsr173</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>${javamail.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
<version>${oro.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>

Show
Matt Raible added a comment - I got Unable to render embedded object: File (maven.test.skip to work - thanks) not found. <profiles> <profile> <id>${cargo.container}</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>${cargo.container.home}</home--> <zipUrlInstaller> <url>${cargo.container.url}</url> <installDir>${installDir}</installDir> </zipUrlInstaller> </container> <configuration> <home>${project.build.directory}/${cargo.container}/container</home> <properties> <cargo.hostname>${cargo.host}</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="${cargo.port}"></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>${webtest.version}</version> <exclusions> <exclusion> <groupId>javax.xml</groupId> <artifactId>jsr173</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>${javamail.version}</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> <dependency> <groupId>oro</groupId> <artifactId>oro</artifactId> <version>${oro.version}</version> </dependency> </dependencies> </plugin> </plugins> </build> </profile> </profiles>
Hide
Riccardo Serafin added a comment -

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.

Show
Riccardo Serafin added a comment - 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.
Hide
Matt Raible added a comment -

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.

Show
Matt Raible added a comment - 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.
Hide
Savas Ali Tokmen added a comment -

Targeting version 1.1.0

Show
Savas Ali Tokmen added a comment - Targeting version 1.1.0
Hide
jieryn added a comment -

I'd also add that Cargo is useful for more things than just testing. Having cargo skip deploying to a remote container because someone passed in -DskipTests seems to be confusing/ mixing concerns. Thanks!

Show
jieryn added a comment - I'd also add that Cargo is useful for more things than just testing. Having cargo skip deploying to a remote container because someone passed in -DskipTests seems to be confusing/ mixing concerns. Thanks!
Hide
Anders Hammar added a comment -

Skip parameter implemented in r2426. Either configure in plugin configuration or through system property cargo.maven.skip. skipTests property is NOT used!

Show
Anders Hammar added a comment - Skip parameter implemented in r2426. Either configure in plugin configuration or through system property cargo.maven.skip. skipTests property is NOT used!
Hide
Ryan Heaton added a comment -

So do we have an estimate of when 1.0.3 is to be released?

Show
Ryan Heaton added a comment - So do we have an estimate of when 1.0.3 is to be released?
Hide
Anders Hammar added a comment -

We are now wrapping up for the 1.0.3 release. It will be released soon! Please check the dev list for progress.

Show
Anders Hammar added a comment - We are now wrapping up for the 1.0.3 release. It will be released soon! Please check the dev list for progress.

People

Vote (7)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: