You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Hoffmann Martin (UniCredit Business Integrated Solutions)" <Ma...@unicredit.de> on 2013/12/13 15:37:48 UTC

Question: Maven Pathes includes and others

Dear All,

I'm trying to get the Junit tests for an multi module Project running. All test run fine, expect one test.

I don't use the standard maven hierarchy, because the project is very old and yet we start to mavenize it.

First of all a snippet of my Child Pom:

        <build>
                <finalName>${project.groupId}_${project.artifactId}</finalName>
                <sourceDirectory>./src</sourceDirectory>
                <testResources>
                        <testResource>
                                <directory>${project.build.sourceDirectory}</directory>
                                <includes>
                                        <include>src/de/hvb/roldial3/core/xml/*.xml</include>
                                        <include>src/de/hvb/roldial3/core/xml/*.xsl</include>
                                </includes>
                                <targetPath>de/hvb/roldial3/core/xml/</targetPath>
                        </testResource>
                        <testResource>
                                <directory>${project.build.sourceDirectory}</directory>
                                <includes>
                                        <include>src/de/hvb/roldial3/core/castor/*.xml</include>
                                </includes>
                                <targetPath>de/hvb/roldial3/core/castor/</targetPath>
                        </testResource>
                        <testResource>
                                <directory>${project.parent.basedir}</directory>
                                <includes>
                                        <include>config/application/MQ/ugiscerts_V20</include>
                                        <include>config/application/MQ/mdrKeyStore</include>
                                </includes>
                                <targetPath>.</targetPath>
                        </testResource>
                </testResources>
                <plugins>
                        <plugin>
                                <groupId>com.google.code.maven-replacer-plugin</groupId>
                                <artifactId>replacer</artifactId>
                                <version>1.5.2</version>
                                <executions>
                                        <execution>
                                                <phase>validate</phase>
                                                <goals>
                                                        <goal>replace</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <file>${project.parent.basedir}/rochade730/appl/rochade.ini</file>
                                        <replacements>
                                                <replacement>
                                                        <token>D:\MavenProjects\roldial3\default</token>
                                                        <value>${project.parent.absolutePath}</value>
                                                </replacement>
                                        </replacements>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <version>3.1</version>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
                                <version>2.16</version>
                                <configuration>
                                        <testFailureIgnore>true</testFailureIgnore>
                                        <testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
                                        <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
                                        <environmentVariables>
                                                <HVBAPPSDATA>${basedir}/${project.parent.relativePath}</HVBAPPSDATA>
                                        </environmentVariables>
                                        <includes>
                                                <include>**/*Test.java</include>
                                        </includes>
                                        <childDelegation>true</childDelegation>
                                        <forkMode>always</forkMode>
                                        <workingDirectory>${user.dir}</workingDirectory>
                                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                                </configuration>
                        </plugin>
                </plugins>
                <resources>
                        <resource>
                                <directory>src</directory>
                                <includes>
                                        <include>*.xml</include>
                                </includes>
                        </resource>
                        <resource>
                                <directory>src/de/hvb/roldial3/core/xml</directory>
                                <includes>
                                        <include>*.xsl</include>
                                        <include>*.xml</include>
                                </includes>
                                <targetPath>de/hvb/roldial3/core/xml</targetPath>
                        </resource>
                        <resource>
                                <directory>src/de/hvb/roldial3/core/castor</directory>
                                <includes>
                                        <include>*.xml</include>
                                </includes>
                                <targetPath>de/hvb/roldial3/core/castor</targetPath>
                        </resource>
                </resources>
        </build>



In my Java class I use the following line, which makes the problem:

String cgfFileName = getSystemProperty("hvbappsdata")
                                        + "/config/application/mq.properties";


The property file looks like this:

WMQ_KEYSTORE_LOCATION=../../MQ/mdrKeyStore
WMQ_TRUSTSTORE_LOCATION=../../MQ/ugiscerts_V20
....

The problem is, that maven doesn't find the pathes mentioned in the property file and therefore the junit test fails. For sure it's only an TestResource problem.

My Folder hierarchy looks likes:

Project
|_________config
                |_____application
                |       Property file
                |       |___________MQ
                |                       |______mdrKeyStore
                |                               Ugiscerts_v20
                |
                Workspace
                        |______module
                                        |_____child.pom
                                        |
                                        |______src
                                                |____package-declaration




Does anybody have an Idea how to get rid of these problem?

Many thanks in advance guys!


Best regards / Mit freundlichen Grüßen / Tanti saluti
-----------------------------------------
Martin Hoffmann
System Specialist
US97019 GCC Application Quality Tools Mgmt



Re: Question: Maven Pathes includes and others

Posted by Russell Gold <ru...@gold-family.us>.
Hi Martin,

On Dec 13, 2013, at 9:37 AM, Hoffmann Martin (UniCredit Business Integrated Solutions) <Ma...@unicredit.de> wrote:

>                                        <environmentVariables>
>                                                <HVBAPPSDATA>${basedir}/${project.parent.relativePath}</HVBAPPSDATA>
>                                        </environmentVariables>


Can you confirm that this is being defined correctly? My initial reaction is that this is actually pointing to the directory above your project, which would cause the file not to be found.

But in general, I presume that you are getting some kind of error message, or else can get the test to dump the path it is using to find the property file. If you could show us that and compare it with the proper path, that would be useful information.


Regards,
Russ
-----------------
Author, Getting Started with Apache Maven <http://www.packtpub.com/getting-started-with-apache-maven/video>

Come read my webnovel, Take a Lemon <http://www.takealemon.com>, 
and listen to the Misfile radio play <http://www.fuzzyfacetheater.com/misfile/>!








RE: Question: Maven Pathes includes and others

Posted by "Hoffmann Martin (UniCredit Business Integrated Solutions)" <Ma...@unicredit.de>.
Hi,

Unfortunately this changes nothing on my problem :(

Any further ideas?

Best regards / Mit freundlichen Grüßen / Tanti saluti
-----------------------------------------
Martin Hoffmann
UniCredit Business Integrated Solutions
US97019 GCC Application Quality Tools Mgmt

Development Tools Support:
• From Monday to Friday - 09:00 to 17:00 
• Email only (in English) - NO OCS or Phone call direct support available. 
• Tools Common Support Mailbox:
UniCredit Business Integrated Solutions - Development-Tools Support 
• Tools Documentation available at the Development Support side:
http://his.intranet.hypovereinsbank.de/IntraNetContent/Bereiche/HIC/HIC3/HIC3CS/Produkte/help-support.html 
• News Development Tools Status are available in the Development Services BLOG:
http://moss-group.intranet.unicreditgroup.eu/projects/DevelopmentServices/DevelopmentServicesBlog/default.aspx
UniCredit is the Official Bank of the UEFA Champions League
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Die gesetzlichen Pflichtangaben zur UniCredit Business Integrated Solutions S.C.p.A., Zweigniederlassung Deutschland, finden Sie unter www.unicredit-business-integrated-solutions.de/pflichtangaben
Bitte denken Sie an die Umwelt, bevor Sie diese Nachricht ausdrucken.

-----Original Message-----
From: Adrien Rivard [mailto:adrien.rivard@gmail.com] 
Sent: Freitag, 13. Dezember 2013 16:33
To: Maven Users List
Subject: Re: Question: Maven Pathes includes and others

Hi,

I would try systemPropertyVariables and not <environmentVariables> in the maven-surefire-plugin

like
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>





On Fri, Dec 13, 2013 at 3:37 PM, Hoffmann Martin (UniCredit Business Integrated Solutions) <Ma...@unicredit.de> wrote:

> Dear All,
>
> I'm trying to get the Junit tests for an multi module Project running. 
> All test run fine, expect one test.
>
> I don't use the standard maven hierarchy, because the project is very 
> old and yet we start to mavenize it.
>
> First of all a snippet of my Child Pom:
>
>         <build>
>
> <finalName>${project.groupId}_${project.artifactId}</finalName>
>                 <sourceDirectory>./src</sourceDirectory>
>                 <testResources>
>                         <testResource>
>
> <directory>${project.build.sourceDirectory}</directory>
>                                 <includes>
>
> <include>src/de/hvb/roldial3/core/xml/*.xml</include>
>
> <include>src/de/hvb/roldial3/core/xml/*.xsl</include>
>                                 </includes>
>
> <targetPath>de/hvb/roldial3/core/xml/</targetPath>
>                         </testResource>
>                         <testResource>
>
> <directory>${project.build.sourceDirectory}</directory>
>                                 <includes>
>
> <include>src/de/hvb/roldial3/core/castor/*.xml</include>
>                                 </includes>
>
> <targetPath>de/hvb/roldial3/core/castor/</targetPath>
>                         </testResource>
>                         <testResource>
>
> <directory>${project.parent.basedir}</directory>
>                                 <includes>
>
> <include>config/application/MQ/ugiscerts_V20</include>
>
> <include>config/application/MQ/mdrKeyStore</include>
>                                 </includes>
>                                 <targetPath>.</targetPath>
>                         </testResource>
>                 </testResources>
>                 <plugins>
>                         <plugin>
>
> <groupId>com.google.code.maven-replacer-plugin</groupId>
>                                 <artifactId>replacer</artifactId>
>                                 <version>1.5.2</version>
>                                 <executions>
>                                         <execution>
>                                                 <phase>validate</phase>
>                                                 <goals>
>
> <goal>replace</goal>
>                                                 </goals>
>                                         </execution>
>                                 </executions>
>                                 <configuration>
>
> <file>${project.parent.basedir}/rochade730/appl/rochade.ini</file>
>                                         <replacements>
>                                                 <replacement>
>
> <token>D:\MavenProjects\roldial3\default</token>
>
> <value>${project.parent.absolutePath}</value>
>                                                 </replacement>
>                                         </replacements>
>                                 </configuration>
>                         </plugin>
>                         <plugin>
>                                 
> <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-compiler-plugin</artifactId>
>                                 <version>3.1</version>
>                         </plugin>
>                         <plugin>
>                                 
> <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-surefire-plugin</artifactId>
>                                 <version>2.16</version>
>                                 <configuration>
>
> <testFailureIgnore>true</testFailureIgnore>
>
> <testSourceDirectory>${project.build.sourceDirectory}</testSourceDirec
> tory>
>
> <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
>                                         <environmentVariables>
>
> <HVBAPPSDATA>${basedir}/${project.parent.relativePath}</HVBAPPSDATA>
>                                         </environmentVariables>
>                                         <includes>
>
> <include>**/*Test.java</include>
>                                         </includes>
>
> <childDelegation>true</childDelegation>
>                                         <forkMode>always</forkMode>
>
> <workingDirectory>${user.dir}</workingDirectory>
>
> <redirectTestOutputToFile>true</redirectTestOutputToFile>
>                                 </configuration>
>                         </plugin>
>                 </plugins>
>                 <resources>
>                         <resource>
>                                 <directory>src</directory>
>                                 <includes>
>                                         <include>*.xml</include>
>                                 </includes>
>                         </resource>
>                         <resource>
>
> <directory>src/de/hvb/roldial3/core/xml</directory>
>                                 <includes>
>                                         <include>*.xsl</include>
>                                         <include>*.xml</include>
>                                 </includes>
>
> <targetPath>de/hvb/roldial3/core/xml</targetPath>
>                         </resource>
>                         <resource>
>
> <directory>src/de/hvb/roldial3/core/castor</directory>
>                                 <includes>
>                                         <include>*.xml</include>
>                                 </includes>
>
> <targetPath>de/hvb/roldial3/core/castor</targetPath>
>                         </resource>
>                 </resources>
>         </build>
>
>
>
> In my Java class I use the following line, which makes the problem:
>
> String cgfFileName = getSystemProperty("hvbappsdata")
>                                         + 
> "/config/application/mq.properties";
>
>
> The property file looks like this:
>
> WMQ_KEYSTORE_LOCATION=../../MQ/mdrKeyStore
> WMQ_TRUSTSTORE_LOCATION=../../MQ/ugiscerts_V20
> ....
>
> The problem is, that maven doesn't find the pathes mentioned in the 
> property file and therefore the junit test fails. For sure it's only 
> an TestResource problem.
>
> My Folder hierarchy looks likes:
>
> Project
> |_________config
>                 |_____application
>                 |       Property file
>                 |       |___________MQ
>                 |                       |______mdrKeyStore
>                 |                               Ugiscerts_v20
>                 |
>                 Workspace
>                         |______module
>                                         |_____child.pom
>                                         |
>                                         |______src
>                                                 
> |____package-declaration
>
>
>
>
> Does anybody have an Idea how to get rid of these problem?
>
> Many thanks in advance guys!
>
>
> Best regards / Mit freundlichen Grüßen / Tanti saluti
> -----------------------------------------
> Martin Hoffmann
> System Specialist
> US97019 GCC Application Quality Tools Mgmt
>
>
>


--
Adrien Rivard

Re: Question: Maven Pathes includes and others

Posted by Adrien Rivard <ad...@gmail.com>.
Hi,

I would try systemPropertyVariables and not <environmentVariables> in the
maven-surefire-plugin

like
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>





On Fri, Dec 13, 2013 at 3:37 PM, Hoffmann Martin (UniCredit Business
Integrated Solutions) <Ma...@unicredit.de> wrote:

> Dear All,
>
> I'm trying to get the Junit tests for an multi module Project running. All
> test run fine, expect one test.
>
> I don't use the standard maven hierarchy, because the project is very old
> and yet we start to mavenize it.
>
> First of all a snippet of my Child Pom:
>
>         <build>
>
> <finalName>${project.groupId}_${project.artifactId}</finalName>
>                 <sourceDirectory>./src</sourceDirectory>
>                 <testResources>
>                         <testResource>
>
> <directory>${project.build.sourceDirectory}</directory>
>                                 <includes>
>
> <include>src/de/hvb/roldial3/core/xml/*.xml</include>
>
> <include>src/de/hvb/roldial3/core/xml/*.xsl</include>
>                                 </includes>
>
> <targetPath>de/hvb/roldial3/core/xml/</targetPath>
>                         </testResource>
>                         <testResource>
>
> <directory>${project.build.sourceDirectory}</directory>
>                                 <includes>
>
> <include>src/de/hvb/roldial3/core/castor/*.xml</include>
>                                 </includes>
>
> <targetPath>de/hvb/roldial3/core/castor/</targetPath>
>                         </testResource>
>                         <testResource>
>
> <directory>${project.parent.basedir}</directory>
>                                 <includes>
>
> <include>config/application/MQ/ugiscerts_V20</include>
>
> <include>config/application/MQ/mdrKeyStore</include>
>                                 </includes>
>                                 <targetPath>.</targetPath>
>                         </testResource>
>                 </testResources>
>                 <plugins>
>                         <plugin>
>
> <groupId>com.google.code.maven-replacer-plugin</groupId>
>                                 <artifactId>replacer</artifactId>
>                                 <version>1.5.2</version>
>                                 <executions>
>                                         <execution>
>                                                 <phase>validate</phase>
>                                                 <goals>
>
> <goal>replace</goal>
>                                                 </goals>
>                                         </execution>
>                                 </executions>
>                                 <configuration>
>
> <file>${project.parent.basedir}/rochade730/appl/rochade.ini</file>
>                                         <replacements>
>                                                 <replacement>
>
> <token>D:\MavenProjects\roldial3\default</token>
>
> <value>${project.parent.absolutePath}</value>
>                                                 </replacement>
>                                         </replacements>
>                                 </configuration>
>                         </plugin>
>                         <plugin>
>                                 <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-compiler-plugin</artifactId>
>                                 <version>3.1</version>
>                         </plugin>
>                         <plugin>
>                                 <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-surefire-plugin</artifactId>
>                                 <version>2.16</version>
>                                 <configuration>
>
> <testFailureIgnore>true</testFailureIgnore>
>
> <testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
>
> <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
>                                         <environmentVariables>
>
> <HVBAPPSDATA>${basedir}/${project.parent.relativePath}</HVBAPPSDATA>
>                                         </environmentVariables>
>                                         <includes>
>
> <include>**/*Test.java</include>
>                                         </includes>
>
> <childDelegation>true</childDelegation>
>                                         <forkMode>always</forkMode>
>
> <workingDirectory>${user.dir}</workingDirectory>
>
> <redirectTestOutputToFile>true</redirectTestOutputToFile>
>                                 </configuration>
>                         </plugin>
>                 </plugins>
>                 <resources>
>                         <resource>
>                                 <directory>src</directory>
>                                 <includes>
>                                         <include>*.xml</include>
>                                 </includes>
>                         </resource>
>                         <resource>
>
> <directory>src/de/hvb/roldial3/core/xml</directory>
>                                 <includes>
>                                         <include>*.xsl</include>
>                                         <include>*.xml</include>
>                                 </includes>
>
> <targetPath>de/hvb/roldial3/core/xml</targetPath>
>                         </resource>
>                         <resource>
>
> <directory>src/de/hvb/roldial3/core/castor</directory>
>                                 <includes>
>                                         <include>*.xml</include>
>                                 </includes>
>
> <targetPath>de/hvb/roldial3/core/castor</targetPath>
>                         </resource>
>                 </resources>
>         </build>
>
>
>
> In my Java class I use the following line, which makes the problem:
>
> String cgfFileName = getSystemProperty("hvbappsdata")
>                                         +
> "/config/application/mq.properties";
>
>
> The property file looks like this:
>
> WMQ_KEYSTORE_LOCATION=../../MQ/mdrKeyStore
> WMQ_TRUSTSTORE_LOCATION=../../MQ/ugiscerts_V20
> ....
>
> The problem is, that maven doesn't find the pathes mentioned in the
> property file and therefore the junit test fails. For sure it's only an
> TestResource problem.
>
> My Folder hierarchy looks likes:
>
> Project
> |_________config
>                 |_____application
>                 |       Property file
>                 |       |___________MQ
>                 |                       |______mdrKeyStore
>                 |                               Ugiscerts_v20
>                 |
>                 Workspace
>                         |______module
>                                         |_____child.pom
>                                         |
>                                         |______src
>                                                 |____package-declaration
>
>
>
>
> Does anybody have an Idea how to get rid of these problem?
>
> Many thanks in advance guys!
>
>
> Best regards / Mit freundlichen Grüßen / Tanti saluti
> -----------------------------------------
> Martin Hoffmann
> System Specialist
> US97019 GCC Application Quality Tools Mgmt
>
>
>


-- 
Adrien Rivard