Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Question: Maven Pathes includes and others

$
0
0
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

Viewing all articles
Browse latest Browse all 5648

Trending Articles