[ 
https://jira.codehaus.org/browse/MNG-5218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=312053#comment-312053
 ] 

Damian Nowak commented on MNG-5218:
-----------------------------------

{quote}
The incompatibility problem could be avoided by introducing a new property, say 
"$\{invocationdir}".
But then, the submodule pom will get different value when invoked from its own 
dir versus when invoked from the project parent dir (or any intermediate). 
This makes it too easy to develop poms where submodules can't be built 
individually (from their own dirs), and I would prefer not going this direction.
{quote}

Totally agreed!

My case: I want to set some surefire system properties for *every* submodule. 
Properties doesn't differ across submodules. Props come from a file in project 
root - it's session.executionRootDirectory if built from root.

# I don't want to copy properties file to every submodule.
# I don't want to copy profile definition to every submodule.
# I want to build modules separately (so can't use 
session.executionRootDirectory).

Can it be achieved in Maven 3?

{code}
        <profile>
            <id>mysql-local-test</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>properties-maven-plugin</artifactId>
                        <version>1.0-alpha-2</version>
                        <executions>
                            <execution>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>read-project-properties</goal>
                                </goals>
                                <configuration>
                                    <files>
                                        
<file>${session.executionRootDirectory}/csp/dao/buildconfigs/mysql-local-test.properties</file>
                                    </files>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <db.type>mysql</db.type>
                                
<sql.log.dir>${project.build.outputDirectory}</sql.log.dir>
                                
<test.jdbc.user>${test.jdbc.user}</test.jdbc.user>
                                
<test.jdbc.password>${test.jdbc.password}</test.jdbc.password>
                                
<test.jdbc.driver>${test.jdbc.driver}</test.jdbc.driver>
                                <test.jdbc.url>${test.jdbc.url}</test.jdbc.url>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
{code}
                
> Allow properties containing ${basedir} to retain same value in sub-modules.
> ---------------------------------------------------------------------------
>
>                 Key: MNG-5218
>                 URL: https://jira.codehaus.org/browse/MNG-5218
>             Project: Maven 2 & 3
>          Issue Type: Improvement
>            Reporter: Ondrej Zizka
>
> Currently, if a property contains ${basedir}, it's value in a submodule 
> contains submodule's base dir.
> I.e., each submodule has this value different.
> While it's handy for some cases (it allows nice recursive solution for some 
> tasks),
> there's no way to have the property with ${basedir} set in the parent module 
> and using it unchanged in submodules.
> That's quite crucial for e.g. complex testsuites.
> The current behavior is surely relied on in many projects, so I'd suggest 
> something like:
> {code}
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to