The solution that you suggested at the end of your message is the best.
Separate all the common code into a core project and have 2 projects that depend on it for producing the final artifacts for particular envoronments.

This may also help in organizing your tests so that you clearly separate tests for the core software from tests that depend on one environment or the other.

It will certainly simplify your project for other developers who might not be familiar with both environments and have trouble sorting through files that do not apply to the environment that they know.

Ron

On 28/06/2014 6:26 PM, Christofer Dutz wrote:
No worries :-)

I was going through the options and I noticed this myself :-)

But is there another option?
I tried the pom dependency with classifier option, but that didn't work (I 
wasn't really expecting it to)

Chris

-----Ursprüngliche Nachricht-----
Von: Stephen Connolly [mailto:[email protected]]
Gesendet: Samstag, 28. Juni 2014 22:40
An: Maven Users List
Betreff: Re: Artifact with different sets of dependencies switched by profiles

Noooooooo!!!

Allowing people to define dependencies in profiles was one of the biggest 
mistakes we made in Model Version 4.0.0.

The activation rules etc are *never* what they think you are once the 
dependency is resolved from the local repository cache.

Please do no do this stupid thing just because we were stupid enough to leave 
it as an option.


On 28 June 2014 19:24, Christofer Dutz <[email protected]> wrote:

Hi,

I am currently working on making the Apache Flex project able to
release as Maven artifacts. For that I have created a tool that
mavenizes a Flex SDK by generating poms and copying and renaming the
libraries it consists of. All is working nicely. In contrast to Java
in Flex you can sort of choose to use static linking (default) or
dynamic linking (rsl). In Flexmojos this is controlled by having a
maven scope of "rsl" for dynamically linked libraries.

Static linking:
                 <dependency>
                     <groupId>org.apache.flex.framework</groupId>
                     <artifactId>spark</artifactId>
                     <version>4.12.1.20140427</version>
                     <type>swc</type>
                 </dependency>

Dynamic linking:
                 <dependency>
                     <groupId>org.apache.flex.framework</groupId>
                     <artifactId>spark</artifactId>
                     <version>4.12.1.20140427</version>
                     <type>swc</type>
                     <scope>rsl</scope>
                 </dependency>

Now I wanted to make it easier for people using Flex so I generated
two profiles in my poms. The default one active by default using
static linking and one "flex-rsl" using dynamic linking wherever possible.
I was thinking of enabling that second profile by setting a property:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <project
xmlns="http://maven.apache.org/POM/4.0.0";>
     <modelVersion>4.0.0</modelVersion>

     <groupId>org.apache.flex</groupId>
     <artifactId>framework</artifactId>
     <version>4.12.1.20140427</version>
     <packaging>pom</packaging>

     <profiles>
         <profile>
             <id>default</id>

             <activation>
                 <activeByDefault>true</activeByDefault>
             </activation>

             <dependencies>

                 ... A lot of dependencies ...

             </dependencies>
         </profile>

         <profile>
             <id>flex-rsl</id>

             <activation>
                 <property>
                     <name>flex.framework.scope</name>
                     <value>rsl</value>
                 </property>
             </activation>

             <dependencies>

                 ... A lot of dependencies ...

             </dependencies>
         </profile>
     </profiles>
</project>

Now I tried activating that second profile by setting that property in
the module referencing that pom artifact:

<properties>
         <flex.version>4.12.1.20140427</flex.version>
         <!-- Turn on rsl linking of swc dependencies -->
         <flex.framework.scope>rsl</flex.framework.scope>
</properties>

<dependencies>
                 <dependency>
                     <groupId>org.apache.flex</groupId>
                     <artifactId>framework</artifactId>
                     <version>${flex.version}</version>
                     <type>pom</type>
                 </dependency>
</dependencies>

But it seems this doesn't work ... so my question is ... is it
possible to do what I want? If not ... is there a way I could achieve
this? After all it seems classifiers for pom modules don't seem to exist.
Or am I wrong here and I could simply generate several pom files
"framework-4.12.1.20140427.pom" and "framework-4.12.1.20140427-rsl.pom"?

Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


--
Ron Wheeler
President
Artifact Software Inc
email: [email protected]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to