maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christofer Dutz <christofer.d...@c-ware.de>
Subject AW: AW: Artifact with different sets of dependencies switched by profiles
Date Sun, 29 Jun 2014 09:00:37 GMT
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 <christofer.dutz@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
Mime
View raw message