You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Christofer Dutz <ch...@c-ware.de> on 2014/06/28 20:24:29 UTC

Artifact with different sets of dependencies switched by profiles

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

AW: AW: AW: Artifact with different sets of dependencies switched by profiles

Posted by Christofer Dutz <ch...@c-ware.de>.
So the only option I have, is to generate different pom artifacts and I can choose the "profile" by selecing different pom artifacts? There is no other option?

Chris


________________________________________
Von: Stephen Connolly <st...@gmail.com>
Gesendet: Dienstag, 1. Juli 2014 15:02
An: Maven Users List
Cc: joerg.schaible@gmx.de
Betreff: Re: AW: AW: Artifact with different sets of dependencies switched by profiles

And you are going to have the exact same set of issues as with profiles.

Maven 3 does not re-interpolate the poms of dependencies IIRC... or at
least it is not supposed to... so you only get to control the variables
from the parent pom and any inherited dependencies/dependencyManagement not
from the transitive dependencies of your pom


On 1 July 2014 10:42, Christofer Dutz <ch...@c-ware.de> wrote:

> Hey ... now that looks promissing :-)
>
> I'll give that a spin as soon as I have time.
>
> I didn't know that you could use variables in the scope (But I think
> that's just some old info probably stored in my brain ages ago).
>
> Chris
>
>
> ________________________________________
> Von: Jörg Schaible <jo...@gmx.de>
> Gesendet: Sonntag, 29. Juni 2014 15:16
> An: users@maven.apache.org
> Betreff: Re: AW: AW: Artifact with different sets of dependencies switched
> by profiles
>
> Hi Christoper,
>
> Christofer Dutz wrote:
>
> > Hi Ron,
> >
> > I think you got what I'm trying to do a little wrong. It's not two
> > different set of dependencies, it's two different ways of linking the
> same
> > set of libraries. If I were to translate this into java, imagine that the
> > default way an application was built would be to include all Classes
> > needed by the application to be bundled in the application Jar (The
> > classes not needed aren't included). Now in modular applications I am
> able
> > to switch to something exactly the same as in Java ... no code is
> included
> > in the Application jar, but the referenced libraries are deployed in
> > parallel to the application jar, so the JVM can pull them in as needed
> (In
> > Flex this type is called rsl (runtime shared library).
> >
> > So in principal I have the same set of dependencies, but in the
> > rsl-linking type these dependencies have an additional "scope=rsl"
> > setting. Up until now there was only one pom with the default set of
> > dependencies. If the users wanted to utilize rsl linking they would have
> > to manually add each dependency and set that's scope to rsl. I would like
> > to make it easier for users to switch.
> >
> > So the profiles is bad, the pom with classifier doesn't work ... I would
> > really like to avoid to have something like an "flramework" artifact and
> > one "framework-rsl" for the rsl linking.
>
> What's the default value for the scope? "compile"? Then you can do all you
> need with properties. You might use a profile, but it is not necessary:
>
> Declare your dependencies just like before (either in depMgmt or directly):
>
> ============== %< =================
>  <dependency>
>    <groupId>org.apache.flex.framework</groupId>
>    <artifactId>spark</artifactId>
>    <version>4.12.1.20140427</version>
>    <type>swc</type>
>    <scope>${flexmojo.scope}</scope>
>  </dependency>
>  ...
>  <properties>
>    <flexmojo.scope>compile</flexmojo.scope>
>  </properties>
> ============== %< =================
>
> Then you can simply redefine "flexmojo.scope" from command line. This will
> also affect inherited dependencies, if they are declared in the same way in
> the repository or if you delcare them in a common parent with a
> dependencyManagement section. You might even overwrite the property in a
> profile:
>
> ============== %< =================
>  <profile>
>    <id>rsl</id>
>    <properties>
>      <flexmojo.scope>rsl</flexmojo.scope>
>    </properties>
>  <profile>
> ============== %< =================
>
> Unfortunately, I don't know nothing about flexmojo. If it works like in the
> world of C where I can use the same libraries (.lib files) to link an
> application either static or dynamically (then requiring runtime libs as
> well), then it is possible to do this. Therefore is is fine for an project
> creating such an application at the end of a build chain.
>
> However, if the libraries differ if build with rsl or not, then you will
> create a very bad user experience, because - just as Stephen already said -
> the build process will use whatever it finds in the local repository, it
> cannot separate between artifacts built with rsl or without. Your users
> might get a wild mix during build time.
>
> Cheers,
> Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: AW: AW: Artifact with different sets of dependencies switched by profiles

Posted by Jörg Schaible <jo...@swisspost.com>.
Hi Stephen,

Stephen Connolly wrote:

> And you are going to have the exact same set of issues as with profiles.
> 
> Maven 3 does not re-interpolate the poms of dependencies IIRC... or at
> least it is not supposed to... so you only get to control the variables
> from the parent pom and any inherited dependencies/dependencyManagement
> not from the transitive dependencies of your pom

The scope declared in the (inherited) dependencyManagement will overwrite 
any transitive or local one (if not explicitly declared). And if that scope 
is defined by a property, you may overwrite this property in the local pom 
or from command line.

However, if the resulting intermediate artifacts differ, he will run in 
problems.

- Jörg


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


Re: AW: AW: Artifact with different sets of dependencies switched by profiles

Posted by Stephen Connolly <st...@gmail.com>.
And you are going to have the exact same set of issues as with profiles.

Maven 3 does not re-interpolate the poms of dependencies IIRC... or at
least it is not supposed to... so you only get to control the variables
from the parent pom and any inherited dependencies/dependencyManagement not
from the transitive dependencies of your pom


On 1 July 2014 10:42, Christofer Dutz <ch...@c-ware.de> wrote:

> Hey ... now that looks promissing :-)
>
> I'll give that a spin as soon as I have time.
>
> I didn't know that you could use variables in the scope (But I think
> that's just some old info probably stored in my brain ages ago).
>
> Chris
>
>
> ________________________________________
> Von: Jörg Schaible <jo...@gmx.de>
> Gesendet: Sonntag, 29. Juni 2014 15:16
> An: users@maven.apache.org
> Betreff: Re: AW: AW: Artifact with different sets of dependencies switched
> by profiles
>
> Hi Christoper,
>
> Christofer Dutz wrote:
>
> > Hi Ron,
> >
> > I think you got what I'm trying to do a little wrong. It's not two
> > different set of dependencies, it's two different ways of linking the
> same
> > set of libraries. If I were to translate this into java, imagine that the
> > default way an application was built would be to include all Classes
> > needed by the application to be bundled in the application Jar (The
> > classes not needed aren't included). Now in modular applications I am
> able
> > to switch to something exactly the same as in Java ... no code is
> included
> > in the Application jar, but the referenced libraries are deployed in
> > parallel to the application jar, so the JVM can pull them in as needed
> (In
> > Flex this type is called rsl (runtime shared library).
> >
> > So in principal I have the same set of dependencies, but in the
> > rsl-linking type these dependencies have an additional "scope=rsl"
> > setting. Up until now there was only one pom with the default set of
> > dependencies. If the users wanted to utilize rsl linking they would have
> > to manually add each dependency and set that's scope to rsl. I would like
> > to make it easier for users to switch.
> >
> > So the profiles is bad, the pom with classifier doesn't work ... I would
> > really like to avoid to have something like an "flramework" artifact and
> > one "framework-rsl" for the rsl linking.
>
> What's the default value for the scope? "compile"? Then you can do all you
> need with properties. You might use a profile, but it is not necessary:
>
> Declare your dependencies just like before (either in depMgmt or directly):
>
> ============== %< =================
>  <dependency>
>    <groupId>org.apache.flex.framework</groupId>
>    <artifactId>spark</artifactId>
>    <version>4.12.1.20140427</version>
>    <type>swc</type>
>    <scope>${flexmojo.scope}</scope>
>  </dependency>
>  ...
>  <properties>
>    <flexmojo.scope>compile</flexmojo.scope>
>  </properties>
> ============== %< =================
>
> Then you can simply redefine "flexmojo.scope" from command line. This will
> also affect inherited dependencies, if they are declared in the same way in
> the repository or if you delcare them in a common parent with a
> dependencyManagement section. You might even overwrite the property in a
> profile:
>
> ============== %< =================
>  <profile>
>    <id>rsl</id>
>    <properties>
>      <flexmojo.scope>rsl</flexmojo.scope>
>    </properties>
>  <profile>
> ============== %< =================
>
> Unfortunately, I don't know nothing about flexmojo. If it works like in the
> world of C where I can use the same libraries (.lib files) to link an
> application either static or dynamically (then requiring runtime libs as
> well), then it is possible to do this. Therefore is is fine for an project
> creating such an application at the end of a build chain.
>
> However, if the libraries differ if build with rsl or not, then you will
> create a very bad user experience, because - just as Stephen already said -
> the build process will use whatever it finds in the local repository, it
> cannot separate between artifacts built with rsl or without. Your users
> might get a wild mix during build time.
>
> Cheers,
> Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

AW: AW: AW: Artifact with different sets of dependencies switched by profiles

Posted by Christofer Dutz <ch...@c-ware.de>.
Hey ... now that looks promissing :-) 

I'll give that a spin as soon as I have time.

I didn't know that you could use variables in the scope (But I think that's just some old info probably stored in my brain ages ago).

Chris


________________________________________
Von: Jörg Schaible <jo...@gmx.de>
Gesendet: Sonntag, 29. Juni 2014 15:16
An: users@maven.apache.org
Betreff: Re: AW: AW: Artifact with different sets of dependencies switched by profiles

Hi Christoper,

Christofer Dutz wrote:

> Hi Ron,
>
> I think you got what I'm trying to do a little wrong. It's not two
> different set of dependencies, it's two different ways of linking the same
> set of libraries. If I were to translate this into java, imagine that the
> default way an application was built would be to include all Classes
> needed by the application to be bundled in the application Jar (The
> classes not needed aren't included). Now in modular applications I am able
> to switch to something exactly the same as in Java ... no code is included
> in the Application jar, but the referenced libraries are deployed in
> parallel to the application jar, so the JVM can pull them in as needed (In
> Flex this type is called rsl (runtime shared library).
>
> So in principal I have the same set of dependencies, but in the
> rsl-linking type these dependencies have an additional "scope=rsl"
> setting. Up until now there was only one pom with the default set of
> dependencies. If the users wanted to utilize rsl linking they would have
> to manually add each dependency and set that's scope to rsl. I would like
> to make it easier for users to switch.
>
> So the profiles is bad, the pom with classifier doesn't work ... I would
> really like to avoid to have something like an "flramework" artifact and
> one "framework-rsl" for the rsl linking.

What's the default value for the scope? "compile"? Then you can do all you
need with properties. You might use a profile, but it is not necessary:

Declare your dependencies just like before (either in depMgmt or directly):

============== %< =================
 <dependency>
   <groupId>org.apache.flex.framework</groupId>
   <artifactId>spark</artifactId>
   <version>4.12.1.20140427</version>
   <type>swc</type>
   <scope>${flexmojo.scope}</scope>
 </dependency>
 ...
 <properties>
   <flexmojo.scope>compile</flexmojo.scope>
 </properties>
============== %< =================

Then you can simply redefine "flexmojo.scope" from command line. This will
also affect inherited dependencies, if they are declared in the same way in
the repository or if you delcare them in a common parent with a
dependencyManagement section. You might even overwrite the property in a
profile:

============== %< =================
 <profile>
   <id>rsl</id>
   <properties>
     <flexmojo.scope>rsl</flexmojo.scope>
   </properties>
 <profile>
============== %< =================

Unfortunately, I don't know nothing about flexmojo. If it works like in the
world of C where I can use the same libraries (.lib files) to link an
application either static or dynamically (then requiring runtime libs as
well), then it is possible to do this. Therefore is is fine for an project
creating such an application at the end of a build chain.

However, if the libraries differ if build with rsl or not, then you will
create a very bad user experience, because - just as Stephen already said -
the build process will use whatever it finds in the local repository, it
cannot separate between artifacts built with rsl or without. Your users
might get a wild mix during build time.

Cheers,
Jörg


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


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


Re: AW: AW: Artifact with different sets of dependencies switched by profiles

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Christoper,

Christofer Dutz wrote:

> Hi Ron,
> 
> I think you got what I'm trying to do a little wrong. It's not two
> different set of dependencies, it's two different ways of linking the same
> set of libraries. If I were to translate this into java, imagine that the
> default way an application was built would be to include all Classes
> needed by the application to be bundled in the application Jar (The
> classes not needed aren't included). Now in modular applications I am able
> to switch to something exactly the same as in Java ... no code is included
> in the Application jar, but the referenced libraries are deployed in
> parallel to the application jar, so the JVM can pull them in as needed (In
> Flex this type is called rsl (runtime shared library).
> 
> So in principal I have the same set of dependencies, but in the
> rsl-linking type these dependencies have an additional "scope=rsl"
> setting. Up until now there was only one pom with the default set of
> dependencies. If the users wanted to utilize rsl linking they would have
> to manually add each dependency and set that's scope to rsl. I would like
> to make it easier for users to switch.
> 
> So the profiles is bad, the pom with classifier doesn't work ... I would
> really like to avoid to have something like an "flramework" artifact and
> one "framework-rsl" for the rsl linking.

What's the default value for the scope? "compile"? Then you can do all you 
need with properties. You might use a profile, but it is not necessary:

Declare your dependencies just like before (either in depMgmt or directly):

============== %< =================
 <dependency>
   <groupId>org.apache.flex.framework</groupId>
   <artifactId>spark</artifactId>
   <version>4.12.1.20140427</version>
   <type>swc</type>
   <scope>${flexmojo.scope}</scope>
 </dependency>
 ...
 <properties>
   <flexmojo.scope>compile</flexmojo.scope>
 </properties>
============== %< =================

Then you can simply redefine "flexmojo.scope" from command line. This will 
also affect inherited dependencies, if they are declared in the same way in 
the repository or if you delcare them in a common parent with a 
dependencyManagement section. You might even overwrite the property in a 
profile:

============== %< =================
 <profile>
   <id>rsl</id>
   <properties>
     <flexmojo.scope>rsl</flexmojo.scope>
   </properties>
 <profile>
============== %< =================

Unfortunately, I don't know nothing about flexmojo. If it works like in the 
world of C where I can use the same libraries (.lib files) to link an 
application either static or dynamically (then requiring runtime libs as 
well), then it is possible to do this. Therefore is is fine for an project 
creating such an application at the end of a build chain.

However, if the libraries differ if build with rsl or not, then you will 
create a very bad user experience, because - just as Stephen already said - 
the build process will use whatever it finds in the local repository, it 
cannot separate between artifacts built with rsl or without. Your users 
might get a wild mix during build time.

Cheers,
Jörg


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


AW: AW: Artifact with different sets of dependencies switched by profiles

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Ron,

I think you got what I'm trying to do a little wrong. It's not two different set of dependencies, it's two different ways of linking the same set of libraries.
If I were to translate this into java, imagine that the default way an application was built would be to include all Classes needed by the application to be bundled in the application Jar (The classes not needed aren't included). Now in modular applications I am able to switch to something exactly the same as in Java ... no code is included in the Application jar, but the referenced libraries are deployed in parallel to the application jar, so the JVM can pull them in as needed (In Flex this type is called rsl (runtime shared library).

So in principal I have the same set of dependencies, but in the rsl-linking type these dependencies have an additional "scope=rsl" setting. Up until now there was only one pom with the default set of dependencies. If the users wanted to utilize rsl linking they would have to manually add each dependency and set that's scope to rsl. I would like to make it easier for users to switch. 

So the profiles is bad, the pom with classifier doesn't work ... I would really like to avoid to have something like an "flramework" artifact and one "framework-rsl" for the rsl linking.

Chris


-----Ursprüngliche Nachricht-----
Von: Ron Wheeler [mailto:rwheeler@artifact-software.com] 
Gesendet: Sonntag, 29. Juni 2014 03:47
An: users@maven.apache.org
Betreff: Re: AW: Artifact with different sets of dependencies switched by profiles

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:stephen.alan.connolly@gmail.com]
> 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 <ch...@c-ware.de> 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: 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


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

Re: AW: Artifact with different sets of dependencies switched by profiles

Posted by Ron Wheeler <rw...@artifact-software.com>.
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:stephen.alan.connolly@gmail.com]
> 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 <ch...@c-ware.de> 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: 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


AW: Artifact with different sets of dependencies switched by profiles

Posted by Christofer Dutz <ch...@c-ware.de>.
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:stephen.alan.connolly@gmail.com] 
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 <ch...@c-ware.de> 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
>

Re: Artifact with different sets of dependencies switched by profiles

Posted by Stephen Connolly <st...@gmail.com>.
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 <ch...@c-ware.de> 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
>