You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Simone Tripodi <si...@gmail.com> on 2008/10/06 15:16:29 UTC

Iterating profiles

Hi everybody,
In the company I'm in a situation where I need to iterate over all
profiles and generate the relative artifact: to be more detailed, my
application has many configuration files, structured as follow:

src
  |
  \- main
        |
        \- config
               |
               \- local
                    |
                    \- *.properties, *.xml

               |
               \- stage
                    |
                    \- *.properties, *.xml

               |
               \- prod
                    |
                    \- *.properties, *.xml

my pom contains some directives to use the config dir:

<project>
    ...
    <profiles>
        <profile>
            <id>local</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <config>local</config>
            </properties>
        </profile>
        <profile>
            <id>stage</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <config>stage</config>
            </properties>
        </profile>
        <profile>
            <id>prod</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <config>prod</config>
            </properties>
        </profile>
    </profiles>
    ....
    <build>
        ...
        <plugins>
            ....
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <archive>
                        <manifest>

<addDefaultImplementationEntries>true</addDefaultImplementationEntries>

<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <configuration>
                            <classifier>${config}</classifier>
                        </configuration>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            ...
        </plugins>
        ...
        <resources>
            <resource>
                <directory>src/main/config/${config}</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        ...
    </build>

</project>

Now, launching on the shell

    mvn deploy -P <profile>

a jar named 'modulename-version-<profile>.jar' will be deployed to my repo.

Now my question is:

is there a way to generate and deploy ALL artifacts FOR EACH profile?
I'm using also the release plugin and my wish is releasing the module
for each configuration!

Many thanks in advance!!!
Best regards,
Simone

-- 
My LinkedIn profile: http://www.linkedin.com/in/simonetripodi
My GoogleCode profile: http://code.google.com/u/simone.tripodi/
My Picasa: http://picasaweb.google.com/simone.tripodi/
My Tube: http://www.youtube.com/user/stripodi
My Del.icio.us: http://del.icio.us/simone.tripodi

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


Re: Iterating profiles

Posted by 陈思淼 <ch...@gmail.com>.
maven just provide the core function like the dependce management. the other
task if you want to complete, you need to write your own plug in, that not
hard work actually.

2008/10/7 Simone Tripodi <si...@gmail.com>

> yes I already thought about it,
> but I was curious if maven provides a feature for this issue. thanks
>
> 2008/10/6 陈思淼 <ch...@gmail.com>:
> > write a shell script to do this kind of thing.
> >
> > 2008/10/6 Simone Tripodi <si...@gmail.com>
> >
> >> Hi everybody,
> >> In the company I'm in a situation where I need to iterate over all
> >> profiles and generate the relative artifact: to be more detailed, my
> >> application has many configuration files, structured as follow:
> >>
> >> src
> >>  |
> >>  \- main
> >>        |
> >>        \- config
> >>               |
> >>               \- local
> >>                    |
> >>                    \- *.properties, *.xml
> >>
> >>               |
> >>               \- stage
> >>                    |
> >>                    \- *.properties, *.xml
> >>
> >>               |
> >>               \- prod
> >>                    |
> >>                    \- *.properties, *.xml
> >>
> >> my pom contains some directives to use the config dir:
> >>
> >> <project>
> >>    ...
> >>    <profiles>
> >>        <profile>
> >>            <id>local</id>
> >>            <activation>
> >>                <activeByDefault>false</activeByDefault>
> >>            </activation>
> >>            <properties>
> >>                <config>local</config>
> >>            </properties>
> >>        </profile>
> >>        <profile>
> >>            <id>stage</id>
> >>            <activation>
> >>                <activeByDefault>false</activeByDefault>
> >>            </activation>
> >>            <properties>
> >>                <config>stage</config>
> >>            </properties>
> >>        </profile>
> >>        <profile>
> >>            <id>prod</id>
> >>            <activation>
> >>                <activeByDefault>false</activeByDefault>
> >>            </activation>
> >>            <properties>
> >>                <config>prod</config>
> >>            </properties>
> >>        </profile>
> >>    </profiles>
> >>    ....
> >>    <build>
> >>        ...
> >>        <plugins>
> >>            ....
> >>            <plugin>
> >>                <groupId>org.apache.maven.plugins</groupId>
> >>                <artifactId>maven-jar-plugin</artifactId>
> >>                <version>2.2</version>
> >>                <configuration>
> >>                    <archive>
> >>                        <manifest>
> >>
> >> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
> >>
> >> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
> >>                        </manifest>
> >>                    </archive>
> >>                </configuration>
> >>                <executions>
> >>                    <execution>
> >>                        <configuration>
> >>                            <classifier>${config}</classifier>
> >>                        </configuration>
> >>                        <goals>
> >>                            <goal>jar</goal>
> >>                        </goals>
> >>                    </execution>
> >>                </executions>
> >>            </plugin>
> >>            ...
> >>        </plugins>
> >>        ...
> >>        <resources>
> >>            <resource>
> >>                <directory>src/main/config/${config}</directory>
> >>            </resource>
> >>            <resource>
> >>                <directory>src/main/resources</directory>
> >>            </resource>
> >>        </resources>
> >>        ...
> >>    </build>
> >>
> >> </project>
> >>
> >> Now, launching on the shell
> >>
> >>    mvn deploy -P <profile>
> >>
> >> a jar named 'modulename-version-<profile>.jar' will be deployed to my
> repo.
> >>
> >> Now my question is:
> >>
> >> is there a way to generate and deploy ALL artifacts FOR EACH profile?
> >> I'm using also the release plugin and my wish is releasing the module
> >> for each configuration!
> >>
> >> Many thanks in advance!!!
> >> Best regards,
> >> Simone
> >>
> >> --
> >> My LinkedIn profile: http://www.linkedin.com/in/simonetripodi
> >> My GoogleCode profile: http://code.google.com/u/simone.tripodi/
> >> My Picasa: http://picasaweb.google.com/simone.tripodi/
> >> My Tube: http://www.youtube.com/user/stripodi
> >> My Del.icio.us: http://del.icio.us/simone.tripodi
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
>
>
>
> --
> My LinkedIn profile: http://www.linkedin.com/in/simonetripodi
> My GoogleCode profile: http://code.google.com/u/simone.tripodi/
> My Picasa: http://picasaweb.google.com/simone.tripodi/
> My Tube: http://www.youtube.com/user/stripodi
> My Del.icio.us: http://del.icio.us/simone.tripodi
>

Re: Iterating profiles

Posted by Simone Tripodi <si...@gmail.com>.
yes I already thought about it,
but I was curious if maven provides a feature for this issue. thanks

2008/10/6 陈思淼 <ch...@gmail.com>:
> write a shell script to do this kind of thing.
>
> 2008/10/6 Simone Tripodi <si...@gmail.com>
>
>> Hi everybody,
>> In the company I'm in a situation where I need to iterate over all
>> profiles and generate the relative artifact: to be more detailed, my
>> application has many configuration files, structured as follow:
>>
>> src
>>  |
>>  \- main
>>        |
>>        \- config
>>               |
>>               \- local
>>                    |
>>                    \- *.properties, *.xml
>>
>>               |
>>               \- stage
>>                    |
>>                    \- *.properties, *.xml
>>
>>               |
>>               \- prod
>>                    |
>>                    \- *.properties, *.xml
>>
>> my pom contains some directives to use the config dir:
>>
>> <project>
>>    ...
>>    <profiles>
>>        <profile>
>>            <id>local</id>
>>            <activation>
>>                <activeByDefault>false</activeByDefault>
>>            </activation>
>>            <properties>
>>                <config>local</config>
>>            </properties>
>>        </profile>
>>        <profile>
>>            <id>stage</id>
>>            <activation>
>>                <activeByDefault>false</activeByDefault>
>>            </activation>
>>            <properties>
>>                <config>stage</config>
>>            </properties>
>>        </profile>
>>        <profile>
>>            <id>prod</id>
>>            <activation>
>>                <activeByDefault>false</activeByDefault>
>>            </activation>
>>            <properties>
>>                <config>prod</config>
>>            </properties>
>>        </profile>
>>    </profiles>
>>    ....
>>    <build>
>>        ...
>>        <plugins>
>>            ....
>>            <plugin>
>>                <groupId>org.apache.maven.plugins</groupId>
>>                <artifactId>maven-jar-plugin</artifactId>
>>                <version>2.2</version>
>>                <configuration>
>>                    <archive>
>>                        <manifest>
>>
>> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
>>
>> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
>>                        </manifest>
>>                    </archive>
>>                </configuration>
>>                <executions>
>>                    <execution>
>>                        <configuration>
>>                            <classifier>${config}</classifier>
>>                        </configuration>
>>                        <goals>
>>                            <goal>jar</goal>
>>                        </goals>
>>                    </execution>
>>                </executions>
>>            </plugin>
>>            ...
>>        </plugins>
>>        ...
>>        <resources>
>>            <resource>
>>                <directory>src/main/config/${config}</directory>
>>            </resource>
>>            <resource>
>>                <directory>src/main/resources</directory>
>>            </resource>
>>        </resources>
>>        ...
>>    </build>
>>
>> </project>
>>
>> Now, launching on the shell
>>
>>    mvn deploy -P <profile>
>>
>> a jar named 'modulename-version-<profile>.jar' will be deployed to my repo.
>>
>> Now my question is:
>>
>> is there a way to generate and deploy ALL artifacts FOR EACH profile?
>> I'm using also the release plugin and my wish is releasing the module
>> for each configuration!
>>
>> Many thanks in advance!!!
>> Best regards,
>> Simone
>>
>> --
>> My LinkedIn profile: http://www.linkedin.com/in/simonetripodi
>> My GoogleCode profile: http://code.google.com/u/simone.tripodi/
>> My Picasa: http://picasaweb.google.com/simone.tripodi/
>> My Tube: http://www.youtube.com/user/stripodi
>> My Del.icio.us: http://del.icio.us/simone.tripodi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>



-- 
My LinkedIn profile: http://www.linkedin.com/in/simonetripodi
My GoogleCode profile: http://code.google.com/u/simone.tripodi/
My Picasa: http://picasaweb.google.com/simone.tripodi/
My Tube: http://www.youtube.com/user/stripodi
My Del.icio.us: http://del.icio.us/simone.tripodi

Re: Iterating profiles

Posted by 陈思淼 <ch...@gmail.com>.
write a shell script to do this kind of thing.

2008/10/6 Simone Tripodi <si...@gmail.com>

> Hi everybody,
> In the company I'm in a situation where I need to iterate over all
> profiles and generate the relative artifact: to be more detailed, my
> application has many configuration files, structured as follow:
>
> src
>  |
>  \- main
>        |
>        \- config
>               |
>               \- local
>                    |
>                    \- *.properties, *.xml
>
>               |
>               \- stage
>                    |
>                    \- *.properties, *.xml
>
>               |
>               \- prod
>                    |
>                    \- *.properties, *.xml
>
> my pom contains some directives to use the config dir:
>
> <project>
>    ...
>    <profiles>
>        <profile>
>            <id>local</id>
>            <activation>
>                <activeByDefault>false</activeByDefault>
>            </activation>
>            <properties>
>                <config>local</config>
>            </properties>
>        </profile>
>        <profile>
>            <id>stage</id>
>            <activation>
>                <activeByDefault>false</activeByDefault>
>            </activation>
>            <properties>
>                <config>stage</config>
>            </properties>
>        </profile>
>        <profile>
>            <id>prod</id>
>            <activation>
>                <activeByDefault>false</activeByDefault>
>            </activation>
>            <properties>
>                <config>prod</config>
>            </properties>
>        </profile>
>    </profiles>
>    ....
>    <build>
>        ...
>        <plugins>
>            ....
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-jar-plugin</artifactId>
>                <version>2.2</version>
>                <configuration>
>                    <archive>
>                        <manifest>
>
> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
>
> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
>                        </manifest>
>                    </archive>
>                </configuration>
>                <executions>
>                    <execution>
>                        <configuration>
>                            <classifier>${config}</classifier>
>                        </configuration>
>                        <goals>
>                            <goal>jar</goal>
>                        </goals>
>                    </execution>
>                </executions>
>            </plugin>
>            ...
>        </plugins>
>        ...
>        <resources>
>            <resource>
>                <directory>src/main/config/${config}</directory>
>            </resource>
>            <resource>
>                <directory>src/main/resources</directory>
>            </resource>
>        </resources>
>        ...
>    </build>
>
> </project>
>
> Now, launching on the shell
>
>    mvn deploy -P <profile>
>
> a jar named 'modulename-version-<profile>.jar' will be deployed to my repo.
>
> Now my question is:
>
> is there a way to generate and deploy ALL artifacts FOR EACH profile?
> I'm using also the release plugin and my wish is releasing the module
> for each configuration!
>
> Many thanks in advance!!!
> Best regards,
> Simone
>
> --
> My LinkedIn profile: http://www.linkedin.com/in/simonetripodi
> My GoogleCode profile: http://code.google.com/u/simone.tripodi/
> My Picasa: http://picasaweb.google.com/simone.tripodi/
> My Tube: http://www.youtube.com/user/stripodi
> My Del.icio.us: http://del.icio.us/simone.tripodi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>