You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andreas Riedel <ri...@yahoo.de> on 2012/07/23 17:26:06 UTC

Activate two profiles at default

Hello users,

I have the following problem:
  - One system must be compiled with two different JDK.
  - I have two test suites, one for smoke test, one for all.

Base scenario:
  - Two profiles, 'SmokeTest' activate by default, 'All' activate by
    switch -P.
  - One additional profile with dependencies only required for build by
    JDK 1.5. At JDK 1.6 these dependencies are part of the JDK itself.

In the POM this is realize as follow:
>>>>>>>>>>>>>>>>
  <profiles>
    <profile>
      <id>smokeTest</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <suiteXmlFiles>
                <suiteXmlFile>src/test/misc/smoke.testng.xml</suiteXmlFile>
              </suiteXmlFiles>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jdk__1_5</id>
      <activation>
        <jdk>1.5</jdk>
      </activation>
      <dependencies>
        ...........
      </dependencies>
    </profile>
    <profile>
      <id>broadsideTest</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <suiteXmlFiles>
                <suiteXmlFile>......</suiteXmlFile>
                <suiteXmlFile>......</suiteXmlFile>
                <suiteXmlFile>......</suiteXmlFile>
                <suiteXmlFile>......</suiteXmlFile>
                <suiteXmlFile>......</suiteXmlFile>
                <suiteXmlFile>......</suiteXmlFile>
                <suiteXmlFile>......</suiteXmlFile>
                <suiteXmlFile>......</suiteXmlFile>
              </suiteXmlFiles>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

<<<<<<<<<<<<<<<<


What I need:
  - Default test to run should always be the smoketest.
  - Under JDK 1.5 the dependencies should be included, but the smoke
    test should also run.

And this is the problem:
  - Under jdk 1.6 it works correct.
  - With JDK 1.5 the profile for JDK 1.5 is taken. I understand the
    logic, but for this scenario it is wrong.
    It should be taken the dependencies from JDK 1.5 profiles and 
    additionally the smoketest should run.
  - This means, the default behaviour should be something like:
    >>>
    mvn help:active-profiles -P smokeTest
    
    The following profiles are active:
     - smokeTest (source: pom)
     - jdk__1_5 (source: pom)
    <<< 
    
    

Any idea what would be the best way to realize this?

TIA
  Andraes

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


Re: Activate two profiles at default

Posted by Wayne Fay <wa...@gmail.com>.
> Any idea what would be the best way to realize this?

Find a way to simplify things. You're doing too much stuff in one
module. Break it into 2 and maybe more.

Wayne

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


Re: Activate two profiles at default

Posted by Stephen Connolly <st...@gmail.com>.
Cannot be classifiers, as he needs different dependencies.

May also want to use tool chains rather than hard coding Jdk paths

On Monday, 23 July 2012, Ron Wheeler wrote:

> It sounds like you have 2 artifacts at the end.
>
> One that is compiled and built with 1.5 and will run under 1.5 JVM and
> probably under 1.6 JVM
> One that is compiled and built with 1.6 and will not run under 1.5 JVM.
>
> It seems that these are 2 different artifacts and should have different
> ArtifactIDs (or at least classifiers).
>
> Can you isolate the code that does not cause any problem and compiles
> under both?
> Make that a jar on its own and then make two projects with the VM
> dependent code.
>
> At some point you will probably drop support for 1.5 and your 1.6 code
> will start to look a lot different as you take advantage of the rest of the
> features of 1.6.
>
> Alternatively you could just build and compile under 1.5 until you are
> ready to drop support for 1.5 in the same way that you no longer support
> 1.4.
>
> Ron
>
> On 23/07/2012 11:26 AM, Andreas Riedel wrote:
>
>> Hello users,
>>
>> I have the following problem:
>>    - One system must be compiled with two different JDK.
>>    - I have two test suites, one for smoke test, one for all.
>>
>> Base scenario:
>>    - Two profiles, 'SmokeTest' activate by default, 'All' activate by
>>      switch -P.
>>    - One additional profile with dependencies only required for build by
>>      JDK 1.5. At JDK 1.6 these dependencies are part of the JDK itself.
>>
>> In the POM this is realize as follow:
>>    <profiles>
>>      <profile>
>>        <id>smokeTest</id>
>>        <activation>
>>          <activeByDefault>true</**activeByDefault>
>>        </activation>
>>        <build>
>>          <plugins>
>>            <plugin>
>>              <groupId>org.apache.maven.**plugins</groupId>
>>              <artifactId>maven-surefire-**plugin</artifactId>
>>              <configuration>
>>                <suiteXmlFiles>
>>                  <suiteXmlFile>src/test/misc/**smoke.testng.xml</**
>> suiteXmlFile>
>>                </suiteXmlFiles>
>>              </configuration>
>>            </plugin>
>>          </plugins>
>>        </build>
>>      </profile>
>>      <profile>
>>        <id>jdk__1_5</id>
>>        <activation>
>>          <jdk>1.5</jdk>
>>        </activation>
>>        <dependencies>
>>          ...........
>>        </dependencies>
>>      </profile>
>>      <profile>
>>        <id>broadsideTest</id>
>>        <build>
>>          <plugins>
>>            <plugin>
>>              <groupId>org.apache.maven.**plugins</groupId>
>>              <artifactId>maven-surefire-**plugin</artifactId>
>>              <configuration>
>>                <suiteXmlFiles>
>>                  <suiteXmlFile>......</**suiteXmlFile>
>>                  <suiteXmlFile>......</**suiteXmlFile>
>>                  <suiteXmlFile>......</**suiteXmlFile>
>>                  <suiteXmlFile>......</**suiteXmlFile>
>>                  <suiteXmlFile>......</**suiteXmlFile>
>>                  <suiteXmlFile>......</**suiteXmlFile>
>>                  <suiteXmlFile>......</**suiteXmlFile>
>>                  <suiteXmlFile>......</**suiteXmlFile>
>>                </suiteXmlFiles>
>>              </configuration>
>>            </plugin>
>>          </plugins>
>>        </build>
>>      </profile>
>>    </profiles>
>>
>> <<<<<<<<<<<<<<<<
>>
>>
>> What I need:
>>    - Default test to run should always be the smoketest.
>>    - Under JDK 1.5 the dependencies should be included, but the smoke
>>      test should also run.
>>
>> And this is the problem:
>>    - Under jdk 1.6 it works correct.
>>    - With JDK 1.5 the profile for JDK 1.5 is taken. I understand the
>>      logic, but for this scenario it is wrong.
>>      It should be taken the dependencies from JDK 1.5 profiles and
>>      additionally the smoketest should run.
>>    - This means, the default behaviour should be something like:
>>      >>>
>>      mvn help:active-profiles -P smokeTest
>>           The following profiles are active:
>>       - smokeTest (source: pom)
>>       - jdk__1_5 (source: pom)
>>      <<<
>>
>> Any idea what would be the best way to realize this?
>>
>> TIA
>>    Andraes
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Activate two profiles at default

Posted by Ron Wheeler <rw...@artifact-software.com>.
It sounds like you have 2 artifacts at the end.

One that is compiled and built with 1.5 and will run under 1.5 JVM and 
probably under 1.6 JVM
One that is compiled and built with 1.6 and will not run under 1.5 JVM.

It seems that these are 2 different artifacts and should have different 
ArtifactIDs (or at least classifiers).

Can you isolate the code that does not cause any problem and compiles 
under both?
Make that a jar on its own and then make two projects with the VM 
dependent code.

At some point you will probably drop support for 1.5 and your 1.6 code 
will start to look a lot different as you take advantage of the rest of 
the features of 1.6.

Alternatively you could just build and compile under 1.5 until you are 
ready to drop support for 1.5 in the same way that you no longer support 
1.4.

Ron

On 23/07/2012 11:26 AM, Andreas Riedel wrote:
> Hello users,
>
> I have the following problem:
>    - One system must be compiled with two different JDK.
>    - I have two test suites, one for smoke test, one for all.
>
> Base scenario:
>    - Two profiles, 'SmokeTest' activate by default, 'All' activate by
>      switch -P.
>    - One additional profile with dependencies only required for build by
>      JDK 1.5. At JDK 1.6 these dependencies are part of the JDK itself.
>
> In the POM this is realize as follow:
>    <profiles>
>      <profile>
>        <id>smokeTest</id>
>        <activation>
>          <activeByDefault>true</activeByDefault>
>        </activation>
>        <build>
>          <plugins>
>            <plugin>
>              <groupId>org.apache.maven.plugins</groupId>
>              <artifactId>maven-surefire-plugin</artifactId>
>              <configuration>
>                <suiteXmlFiles>
>                  <suiteXmlFile>src/test/misc/smoke.testng.xml</suiteXmlFile>
>                </suiteXmlFiles>
>              </configuration>
>            </plugin>
>          </plugins>
>        </build>
>      </profile>
>      <profile>
>        <id>jdk__1_5</id>
>        <activation>
>          <jdk>1.5</jdk>
>        </activation>
>        <dependencies>
>          ...........
>        </dependencies>
>      </profile>
>      <profile>
>        <id>broadsideTest</id>
>        <build>
>          <plugins>
>            <plugin>
>              <groupId>org.apache.maven.plugins</groupId>
>              <artifactId>maven-surefire-plugin</artifactId>
>              <configuration>
>                <suiteXmlFiles>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                </suiteXmlFiles>
>              </configuration>
>            </plugin>
>          </plugins>
>        </build>
>      </profile>
>    </profiles>
>
> <<<<<<<<<<<<<<<<
>
>
> What I need:
>    - Default test to run should always be the smoketest.
>    - Under JDK 1.5 the dependencies should be included, but the smoke
>      test should also run.
>
> And this is the problem:
>    - Under jdk 1.6 it works correct.
>    - With JDK 1.5 the profile for JDK 1.5 is taken. I understand the
>      logic, but for this scenario it is wrong.
>      It should be taken the dependencies from JDK 1.5 profiles and
>      additionally the smoketest should run.
>    - This means, the default behaviour should be something like:
>      >>>
>      mvn help:active-profiles -P smokeTest
>      
>      The following profiles are active:
>       - smokeTest (source: pom)
>       - jdk__1_5 (source: pom)
>      <<<
>      
>      
>
> Any idea what would be the best way to realize this?
>
> TIA
>    Andraes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


Re: Activate two profiles at default

Posted by "Asmann, Roland" <Ro...@adesso.at>.
If those tests should always run, why have them in a profile??


On 23.07.2012 17:26, Andreas Riedel wrote:
> Hello users,
>
> I have the following problem:
>    - One system must be compiled with two different JDK.
>    - I have two test suites, one for smoke test, one for all.
>
> Base scenario:
>    - Two profiles, 'SmokeTest' activate by default, 'All' activate by
>      switch -P.
>    - One additional profile with dependencies only required for build by
>      JDK 1.5. At JDK 1.6 these dependencies are part of the JDK itself.
>
> In the POM this is realize as follow:
>>>>>>>>>>>>>>>>>
>    <profiles>
>      <profile>
>        <id>smokeTest</id>
>        <activation>
>          <activeByDefault>true</activeByDefault>
>        </activation>
>        <build>
>          <plugins>
>            <plugin>
>              <groupId>org.apache.maven.plugins</groupId>
>              <artifactId>maven-surefire-plugin</artifactId>
>              <configuration>
>                <suiteXmlFiles>
>                  <suiteXmlFile>src/test/misc/smoke.testng.xml</suiteXmlFile>
>                </suiteXmlFiles>
>              </configuration>
>            </plugin>
>          </plugins>
>        </build>
>      </profile>
>      <profile>
>        <id>jdk__1_5</id>
>        <activation>
>          <jdk>1.5</jdk>
>        </activation>
>        <dependencies>
>          ...........
>        </dependencies>
>      </profile>
>      <profile>
>        <id>broadsideTest</id>
>        <build>
>          <plugins>
>            <plugin>
>              <groupId>org.apache.maven.plugins</groupId>
>              <artifactId>maven-surefire-plugin</artifactId>
>              <configuration>
>                <suiteXmlFiles>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                  <suiteXmlFile>......</suiteXmlFile>
>                </suiteXmlFiles>
>              </configuration>
>            </plugin>
>          </plugins>
>        </build>
>      </profile>
>    </profiles>
>
> <<<<<<<<<<<<<<<<
>
>
> What I need:
>    - Default test to run should always be the smoketest.
>    - Under JDK 1.5 the dependencies should be included, but the smoke
>      test should also run.
>
> And this is the problem:
>    - Under jdk 1.6 it works correct.
>    - With JDK 1.5 the profile for JDK 1.5 is taken. I understand the
>      logic, but for this scenario it is wrong.
>      It should be taken the dependencies from JDK 1.5 profiles and
>      additionally the smoketest should run.
>    - This means, the default behaviour should be something like:
>      >>>
>      mvn help:active-profiles -P smokeTest
>
>      The following profiles are active:
>       - smokeTest (source: pom)
>       - jdk__1_5 (source: pom)
>      <<<
>
>
>
> Any idea what would be the best way to realize this?
>
> TIA
>    Andraes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock              T +43 1 2198790-27
Floridsdorfer Hauptstr. 1           F +43 1 2198790-927
A-1210 Wien                         M +43 664 88657566
                                    E roland.asmann@adesso.at
                                    W www.adesso.at

-------------------------------------------------------------
             >>> business. people. technology. <<<
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org