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 Artifact with different sets of dependencies switched by profiles
Date Sat, 28 Jun 2014 18:24:29 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message