You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Viktor Sadovnikov <vl...@yahoo.com> on 2010/12/07 12:08:34 UTC

Compiling test classes and using ${project.name}

Hello,

I'm migrating our ANT + Ivy based projects to Maven and came across a strange 
problem with compiling test classes.

Currently I have only on parent pom.xml, which controls common for all modules 
settings, and one child module. The child module compiles and tests perfectly as 
long as <build><directory> is kept to default. However we prefer to keep 
temporary files outside of modules, therefore I changed <directory> as it shown 
below. Compilation still succeeds, but compiler plugin fails to compile test 
classes in "test" phase - it doesn't file compiled main classes. I also noticed 
that if the directory name is fixed (doesn't use ${project.name}) compilation of 
test classes succeeds either.

Is it OK to use ${project.name} as I'm using? 

With regards,
Viktor

<build>

<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<directory>../.build/${project.name}/target</directory>

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<systemPropertyVariables>
<com.fiserv.storage.dir>${storage.dir}</com.fiserv.storage.dir>
<log4j.configuration>file:${storage.dir}/log4j.xml</log4j.configuration>
<com.fiserv.application.dir>${com.fiserv.application.dir}</com.fiserv.application.dir>

<com.fiserv.classes.dir>${project.build.outputDirectory}</com.fiserv.classes.dir>

</systemPropertyVariables>
</configuration>
</plugin>

</plugins>
</build>


      

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


Re: Compiling test classes and using ${project.name}

Posted by Milos Kleint <mk...@gmail.com>.
project name can be anything (or nothing).. it's for sure not intended
to be used in filesystem paths.. don't use it.

Milos

On Tue, Dec 7, 2010 at 12:36 PM, Anders Hammar <an...@hammar.net> wrote:
> Maven best-practice is to stick to Maven conventions. You're not doing that
> and therefore you're running into trouble.
>
> I'm guessing here, but you've probably run into some limitation in the
> testCompile goal of m-compile-p. I suggest you change your opinion regarding
> where Maven creates files during build and follow the Maven standard. Your
> life will be much easier then.
>
> /Anders
> On Tue, Dec 7, 2010 at 12:08, Viktor Sadovnikov <vl...@yahoo.com>wrote:
>
>> Hello,
>>
>> I'm migrating our ANT + Ivy based projects to Maven and came across a
>> strange
>> problem with compiling test classes.
>>
>> Currently I have only on parent pom.xml, which controls common for all
>> modules
>> settings, and one child module. The child module compiles and tests
>> perfectly as
>> long as <build><directory> is kept to default. However we prefer to keep
>> temporary files outside of modules, therefore I changed <directory> as it
>> shown
>> below. Compilation still succeeds, but compiler plugin fails to compile
>> test
>> classes in "test" phase - it doesn't file compiled main classes. I also
>> noticed
>> that if the directory name is fixed (doesn't use ${project.name})
>> compilation of
>> test classes succeeds either.
>>
>> Is it OK to use ${project.name} as I'm using?
>>
>> With regards,
>> Viktor
>>
>> <build>
>>
>> <sourceDirectory>src</sourceDirectory>
>> <testSourceDirectory>test</testSourceDirectory>
>> <directory>../.build/${project.name}/target</directory>
>>
>> <plugins>
>>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-compiler-plugin</artifactId>
>> <version>2.3.2</version>
>> <configuration>
>> <source>1.6</source>
>> <target>1.6</target>
>> </configuration>
>> </plugin>
>>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-surefire-plugin</artifactId>
>> <version>2.6</version>
>> <configuration>
>> <systemPropertyVariables>
>> <com.fiserv.storage.dir>${storage.dir}</com.fiserv.storage.dir>
>> <log4j.configuration>file:${storage.dir}/log4j.xml</log4j.configuration>
>>
>> <com.fiserv.application.dir>${com.fiserv.application.dir}</com.fiserv.application.dir>
>>
>>
>> <com.fiserv.classes.dir>${project.build.outputDirectory}</com.fiserv.classes.dir>
>>
>> </systemPropertyVariables>
>> </configuration>
>> </plugin>
>>
>> </plugins>
>> </build>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

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


Re: Compiling test classes and using ${project.name}

Posted by Anders Hammar <an...@hammar.net>.
Maven best-practice is to stick to Maven conventions. You're not doing that
and therefore you're running into trouble.

I'm guessing here, but you've probably run into some limitation in the
testCompile goal of m-compile-p. I suggest you change your opinion regarding
where Maven creates files during build and follow the Maven standard. Your
life will be much easier then.

/Anders
On Tue, Dec 7, 2010 at 12:08, Viktor Sadovnikov <vl...@yahoo.com>wrote:

> Hello,
>
> I'm migrating our ANT + Ivy based projects to Maven and came across a
> strange
> problem with compiling test classes.
>
> Currently I have only on parent pom.xml, which controls common for all
> modules
> settings, and one child module. The child module compiles and tests
> perfectly as
> long as <build><directory> is kept to default. However we prefer to keep
> temporary files outside of modules, therefore I changed <directory> as it
> shown
> below. Compilation still succeeds, but compiler plugin fails to compile
> test
> classes in "test" phase - it doesn't file compiled main classes. I also
> noticed
> that if the directory name is fixed (doesn't use ${project.name})
> compilation of
> test classes succeeds either.
>
> Is it OK to use ${project.name} as I'm using?
>
> With regards,
> Viktor
>
> <build>
>
> <sourceDirectory>src</sourceDirectory>
> <testSourceDirectory>test</testSourceDirectory>
> <directory>../.build/${project.name}/target</directory>
>
> <plugins>
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.3.2</version>
> <configuration>
> <source>1.6</source>
> <target>1.6</target>
> </configuration>
> </plugin>
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>2.6</version>
> <configuration>
> <systemPropertyVariables>
> <com.fiserv.storage.dir>${storage.dir}</com.fiserv.storage.dir>
> <log4j.configuration>file:${storage.dir}/log4j.xml</log4j.configuration>
>
> <com.fiserv.application.dir>${com.fiserv.application.dir}</com.fiserv.application.dir>
>
>
> <com.fiserv.classes.dir>${project.build.outputDirectory}</com.fiserv.classes.dir>
>
> </systemPropertyVariables>
> </configuration>
> </plugin>
>
> </plugins>
> </build>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>