Jørgen Bundgaard Wanscher created MCOMPILER-255:
---------------------------------------------------

             Summary: test-compile targets wrong directory
                 Key: MCOMPILER-255
                 URL: https://issues.apache.org/jira/browse/MCOMPILER-255
             Project: Maven Compiler Plugin
          Issue Type: Bug
    Affects Versions: 3.3, 3.2, 3.1, 3.0
         Environment: Darwin local 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 
19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 
2015-11-10T17:41:47+01:00)
Maven home: /usr/local/apache-maven
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: da_DK, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.1", arch: "x86_64", family: "mac"
            Reporter: Jørgen Bundgaard Wanscher


I am using the buildNumber plugin:
                        <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>buildnumber-maven-plugin</artifactId>
                          <version>1.4</version>
                          <executions>
                            <execution>
                              <phase>validate</phase>
                              <goals>
                                <goal>create</goal>
                              </goals>
                            </execution>
                          </executions>
                          <configuration>
                            <doCheck>false</doCheck>
                            <doUpdate>false</doUpdate>
                            <revisionOnScmFailure>offline</revisionOnScmFailure>
                          </configuration>
                        </plugin>
And using the variable buildNumber to define the directory:
<directory>${basedir}/target/${project.artifactId}-${project.version}-${buildNumber}</directory>

When running the "mvn test-compile" command the console shows:
 [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ 
CorrectionTool ---
 [INFO] Changes detected - recompiling the module!
 [INFO] Compiling 39 source files to /Users/jbw/Projects/Correction 
Tool/target/CorrectionTool-0.3.0-557/classes
 [INFO] 
.....
 [INFO] 
 [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ 
CorrectionTool ---
 [INFO] Changes detected - recompiling the module!
 [INFO] Compiling 22 source files to /Users/jbw/Projects/Correction 
Tool/target/CorrectionTool-0.3.0-557/test-classes

Which all looks fine. 
But then I get hundreds of generic errors on the test source cannot find the 
main classes that where just compiled.
[ERROR] /Users/jbw/Projects/Correction Tool/test/dawan/PathTest.java:[21,17] 
cannot find symbol
  symbol:   class Path
  location: class dawan.PathTest

If I look at the target directory structure the "ls -Rd target/*" result is:
target/CorrectionTool-0.3.0-${buildNumber}      target/CorrectionTool-0.3.0-557

Which indicates that you are targeting both the partially and the fully 
substitute path for processing.

If I modify my directory setting to include only maven's own variables or 
non-existing variables like:
 
<directory>${basedir}/target/${project.artifactId}-${project.version}-${thisDoesNotExist}</directory>

It works fine as all compile outcome wind up in the same target directory.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to