You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Robert Mark Bram <ro...@gmail.com> on 2014/10/09 10:23:07 UTC

What packaging to use for a sub-module that just runs integration tests?

My parent POM declares this Selenium project in a profile.
   <profile>
      <id>default-build</id>
      <!-- This profile will be active if another profile isn't triggered -->
      <activation>
         <activeByDefault>true</activeByDefault>
      </activation>
      <modules>
         <module>FooProject-Model</module>
         <module>FooProject-Thermal</module>
         <module>FooProject-ViewController</module>
         <module>FooProject-API-V1</module>
         <module>FooProject-Monitoring</module>
         <module>FooProject-ADF</module>
         <module>FooProject-BIRT</module>
         <module>FooProject-Selenium</module>
      </modules>
   </profile>

And the Selenium pom (sub-module) has the following:

Packaging
   <packaging>jar</packaging>

Depend on the ear being built and deployed from another sub-module project.
   <dependencies>
      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>FooProject-ADF</artifactId>
         <version>1.0</version>
         <type>ear</type>
      </dependency>

Run integration tests.
   </dependencies>
   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.17</version>
            <configuration>
               <forkMode>once</forkMode>
            </configuration>
            <executions>
               <execution>
                  <goals>
                     <goal>integration-test</goal>
                     <goal>verify</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>

The build (run from parent pom) is failing with this error:
   [ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
(default-deploy) on project FooProject-Selenium: Deployment failed:
repository element was not specified in the POM inside
distributionManagement element or in
-DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

I understand this is because by specifying package as jar, Mavan wants
to know where I want to put the FooProject-Selenium jar, and of course
I don't want to generate a jar at all.

I have ready suggestions that I should use the pom packaging statement
and http://stackoverflow.com/a/8845858/257233 says that if I do that,
I will have to explicitly call my goals with
   mvn clean compiler:testCompile surefire:test
But I don't want this - I need the parent pom to be able to be able to
co-ordinate the entire build.

So.. what is the best way to deal with this?

Rob
:)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: What packaging to use for a sub-module that just runs integration tests?

Posted by Stephen Connolly <st...@gmail.com>.
On 9 October 2014 14:01, Robert Mark Bram <ro...@gmail.com> wrote:

> > Well the question you really will want to know is:
> >
> > "do I want any other modules to depend on the integration tests being
> > successful?"
>
> The Hatter opened his eyes very wide on hearing this; but all he said
> was, "Why is a mvn like a writing-desk?"
>
> > If the answer is "no" then you will just configure the integration test
> > module with
> >
> <plugin><artifactId>maven-deploy-plugin</artifactId></configuration><skip>true</skip></configuration></plugin>
>
> Thanks again Stephen - nail, head and hammer. In my case, I have
> nothing else depending on the Selenium project.
>
> > If the answer is "yes" then you will most likely need to deploy something
> > (<packaging>pom</packaging>) and that may require adding the missing
> > bindings into the lifecycle.
>
> Let me see if I understand this (though it isn't my case right now).
> If I wanted to trigger something else based upon the Selenium tests
> successful completion, I should have the Selenium POM use a deploy
> phase so that some other project could depend on that artifact in the
> same way that my Selenium POM is depending on an EAR being deployed?
>
>    <dependency>
>       <groupId>${project.groupId}</groupId>
>       <artifactId>FooProject-ADF</artifactId>
>       <version>1.0</version>
>       <type>ear</type>
>    </dependency>
>
> If you are saying this, and I use <packaging>pom</packaging>, what
> exactly would the Selenium project deploy?
>
>
just the pom file.

and that way if the integration tests' pom was not deployed to the repo
then on another machine you will be unable to build the separate project
that required that the integration tests ran.

The case here is rather advanced and typically where you need to build
different packagings on different machines... think windows installer and
deb and rpm which all depend on the .ear


> Rob
> :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: What packaging to use for a sub-module that just runs integration tests?

Posted by Robert Mark Bram <ro...@gmail.com>.
> Well the question you really will want to know is:
>
> "do I want any other modules to depend on the integration tests being
> successful?"

The Hatter opened his eyes very wide on hearing this; but all he said
was, "Why is a mvn like a writing-desk?"

> If the answer is "no" then you will just configure the integration test
> module with
> <plugin><artifactId>maven-deploy-plugin</artifactId></configuration><skip>true</skip></configuration></plugin>

Thanks again Stephen - nail, head and hammer. In my case, I have
nothing else depending on the Selenium project.

> If the answer is "yes" then you will most likely need to deploy something
> (<packaging>pom</packaging>) and that may require adding the missing
> bindings into the lifecycle.

Let me see if I understand this (though it isn't my case right now).
If I wanted to trigger something else based upon the Selenium tests
successful completion, I should have the Selenium POM use a deploy
phase so that some other project could depend on that artifact in the
same way that my Selenium POM is depending on an EAR being deployed?

   <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>FooProject-ADF</artifactId>
      <version>1.0</version>
      <type>ear</type>
   </dependency>

If you are saying this, and I use <packaging>pom</packaging>, what
exactly would the Selenium project deploy?

Rob
:)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: What packaging to use for a sub-module that just runs integration tests?

Posted by Stephen Connolly <st...@gmail.com>.
Well the question you really will want to know is:

"do I want any other modules to depend on the integration tests being
successful?"

If the answer is "yes" then you will most likely need to deploy something
(<packaging>pom</packaging>) and that may require adding the missing
bindings into the lifecycle.

If the answer is "no" then you will just configure the integration test
module with
<plugin><artifactId>maven-deploy-plugin</artifactId></configuration><skip>true</skip></configuration></plugin>


On 9 October 2014 09:23, Robert Mark Bram <
robertmarkbram+mailing.lists@gmail.com> wrote:

> My parent POM declares this Selenium project in a profile.
>    <profile>
>       <id>default-build</id>
>       <!-- This profile will be active if another profile isn't triggered
> -->
>       <activation>
>          <activeByDefault>true</activeByDefault>
>       </activation>
>       <modules>
>          <module>FooProject-Model</module>
>          <module>FooProject-Thermal</module>
>          <module>FooProject-ViewController</module>
>          <module>FooProject-API-V1</module>
>          <module>FooProject-Monitoring</module>
>          <module>FooProject-ADF</module>
>          <module>FooProject-BIRT</module>
>          <module>FooProject-Selenium</module>
>       </modules>
>    </profile>
>
> And the Selenium pom (sub-module) has the following:
>
> Packaging
>    <packaging>jar</packaging>
>
> Depend on the ear being built and deployed from another sub-module project.
>    <dependencies>
>       <dependency>
>          <groupId>${project.groupId}</groupId>
>          <artifactId>FooProject-ADF</artifactId>
>          <version>1.0</version>
>          <type>ear</type>
>       </dependency>
>
> Run integration tests.
>    </dependencies>
>    <build>
>       <plugins>
>          <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-failsafe-plugin</artifactId>
>             <version>2.17</version>
>             <configuration>
>                <forkMode>once</forkMode>
>             </configuration>
>             <executions>
>                <execution>
>                   <goals>
>                      <goal>integration-test</goal>
>                      <goal>verify</goal>
>                   </goals>
>                </execution>
>             </executions>
>          </plugin>
>       </plugins>
>    </build>
>
> The build (run from parent pom) is failing with this error:
>    [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
> (default-deploy) on project FooProject-Selenium: Deployment failed:
> repository element was not specified in the POM inside
> distributionManagement element or in
> -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
>
> I understand this is because by specifying package as jar, Mavan wants
> to know where I want to put the FooProject-Selenium jar, and of course
> I don't want to generate a jar at all.
>
> I have ready suggestions that I should use the pom packaging statement
> and http://stackoverflow.com/a/8845858/257233 says that if I do that,
> I will have to explicitly call my goals with
>    mvn clean compiler:testCompile surefire:test
> But I don't want this - I need the parent pom to be able to be able to
> co-ordinate the entire build.
>
> So.. what is the best way to deal with this?
>
> Rob
> :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: What packaging to use for a sub-module that just runs integration tests?

Posted by Robert Mark Bram <ro...@gmail.com>.
> I would try to skip  the deploy goal for this particular plugin
> see http://maven.apache.org/plugins/maven-deploy-plugin/faq.html#skip

Ah, yes - this is what I needed. So still use jar packaging but skip
the deploy phase.


Rob
:)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: What packaging to use for a sub-module that just runs integration tests?

Posted by Adrien Rivard <ad...@gmail.com>.
Hi,

I would try to skip  the deploy goal for this particular plugin
see http://maven.apache.org/plugins/maven-deploy-plugin/faq.html#skip

On Thu, Oct 9, 2014 at 10:23 AM, Robert Mark Bram <
robertmarkbram+mailing.lists@gmail.com> wrote:

> My parent POM declares this Selenium project in a profile.
>    <profile>
>       <id>default-build</id>
>       <!-- This profile will be active if another profile isn't triggered
> -->
>       <activation>
>          <activeByDefault>true</activeByDefault>
>       </activation>
>       <modules>
>          <module>FooProject-Model</module>
>          <module>FooProject-Thermal</module>
>          <module>FooProject-ViewController</module>
>          <module>FooProject-API-V1</module>
>          <module>FooProject-Monitoring</module>
>          <module>FooProject-ADF</module>
>          <module>FooProject-BIRT</module>
>          <module>FooProject-Selenium</module>
>       </modules>
>    </profile>
>
> And the Selenium pom (sub-module) has the following:
>
> Packaging
>    <packaging>jar</packaging>
>
> Depend on the ear being built and deployed from another sub-module project.
>    <dependencies>
>       <dependency>
>          <groupId>${project.groupId}</groupId>
>          <artifactId>FooProject-ADF</artifactId>
>          <version>1.0</version>
>          <type>ear</type>
>       </dependency>
>
> Run integration tests.
>    </dependencies>
>    <build>
>       <plugins>
>          <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-failsafe-plugin</artifactId>
>             <version>2.17</version>
>             <configuration>
>                <forkMode>once</forkMode>
>             </configuration>
>             <executions>
>                <execution>
>                   <goals>
>                      <goal>integration-test</goal>
>                      <goal>verify</goal>
>                   </goals>
>                </execution>
>             </executions>
>          </plugin>
>       </plugins>
>    </build>
>
> The build (run from parent pom) is failing with this error:
>    [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
> (default-deploy) on project FooProject-Selenium: Deployment failed:
> repository element was not specified in the POM inside
> distributionManagement element or in
> -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
>
> I understand this is because by specifying package as jar, Mavan wants
> to know where I want to put the FooProject-Selenium jar, and of course
> I don't want to generate a jar at all.
>
> I have ready suggestions that I should use the pom packaging statement
> and http://stackoverflow.com/a/8845858/257233 says that if I do that,
> I will have to explicitly call my goals with
>    mvn clean compiler:testCompile surefire:test
> But I don't want this - I need the parent pom to be able to be able to
> co-ordinate the entire build.
>
> So.. what is the best way to deal with this?
>
> Rob
> :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Adrien Rivard