Jakub Bochenski created MCOMPILER-251:
-----------------------------------------

             Summary: testCompile silently ignores compilation errors 
(sometimes)
                 Key: MCOMPILER-251
                 URL: https://issues.apache.org/jira/browse/MCOMPILER-251
             Project: Maven Compiler Plugin
          Issue Type: Bug
    Affects Versions: 3.3
            Reporter: Jakub Bochenski


If I have a file {{UserTestFactory.java}} containing a class {{UnitTestUtil}}
I get an error as expected:{code}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile 
(default-testCompile) on project common_platform: Compilation failure: 
Compilation failure:
[ERROR] 
/home/acme/trunk_avalon/module/common_platform/src_test/com/acme/test/util/UserTestFactory.java:[10,8]
 class UnitTestUtil is public, should be declared in a file named 
UnitTestUtil.java{code}

However if I add another file {{FooUnitTest.java}}, having an import statement 
{{import com.acme.test.util.UserTestFactory;}} then the error is silently 
ignored. No classes appear in the test output directory.
{code}[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ 
common_platform ---
[INFO] Compiling 170 source files to 
/home/acme/trunk_avalon/module/common_platform/build/testClasses
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ common_platform 
---
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ common_platform ---
[INFO] Building jar: 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-assembly-plugin:2.5.3:single (default) @ common_platform ---
[INFO] Reading assembly descriptor: assembly/placeholders.xml
[INFO] Reading assembly descriptor: assembly/log-config.xml
[INFO] Building zip: 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT-placeholders.zip
[INFO] Building zip: 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT-log-config.zip
[INFO] 
[INFO] --- maven-assembly-plugin:2.5.3:single (assembly-overlay) @ 
common_platform ---
[INFO] Reading assembly descriptor: assembly/overlay.xml
[INFO] Building war: 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT.war
[INFO] 
[INFO] --- maven-jar-plugin:2.6:test-jar (default-test-jar) @ common_platform 
---
[INFO] Building jar: 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT-tests.jar
[INFO] 
[INFO] --- sortpom-maven-plugin:2.4.0:verify (default) @ common_platform ---
[INFO] Verifying file /home/acme/trunk_avalon/module/common_platform/pom.xml
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ 
common_platform ---
[INFO] Installing 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT.jar
 to 
/home/acme/.m2/repository/com/acme/common_platform/0.0.1-SNAPSHOT/common_platform-0.0.1-SNAPSHOT.jar
[INFO] Installing /home/acme/trunk_avalon/module/common_platform/pom.xml to 
/home/acme/.m2/repository/com/acme/common_platform/0.0.1-SNAPSHOT/common_platform-0.0.1-SNAPSHOT.pom
[INFO] Installing 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT-placeholders.zip
 to 
/home/acme/.m2/repository/com/acme/common_platform/0.0.1-SNAPSHOT/common_platform-0.0.1-SNAPSHOT-placeholders.zip
[INFO] Installing 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT-log-config.zip
 to 
/home/acme/.m2/repository/com/acme/common_platform/0.0.1-SNAPSHOT/common_platform-0.0.1-SNAPSHOT-log-config.zip
[INFO] Installing 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT.war
 to 
/home/acme/.m2/repository/com/acme/common_platform/0.0.1-SNAPSHOT/common_platform-0.0.1-SNAPSHOT.war
[INFO] Installing 
/home/acme/trunk_avalon/module/common_platform/target/common_platform-0.0.1-SNAPSHOT-tests.jar
 to 
/home/acme/.m2/repository/com/acme/common_platform/0.0.1-SNAPSHOT/common_platform-0.0.1-SNAPSHOT-tests.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.666 s
[INFO] Finished at: 2015-09-01T14:41:01+01:00
[INFO] Final Memory: 54M/730M
[INFO] ------------------------------------------------------------------------
{code}

Plugin configuration:
{code}
[DEBUG] Configuring mojo 
org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile from plugin 
realm ClassRealm[plugin>org.apache.maven.plugins:maven-compiler-plugin:3.3, 
parent: sun.misc.Launcher$AppClassLoader@10b28f30]
[DEBUG] Configuring mojo 
'org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile' with basic 
configurator -->
[DEBUG]   (f) basedir = /home/acme/trunk_avalon/module/common_platform
[DEBUG]   (f) buildDirectory = 
/home/acme/trunk_avalon/module/common_platform/target
[DEBUG]   (f) classpathElements = [ ... ]
[DEBUG]   (f) compileSourceRoots = 
[/home/acme/trunk_avalon/module/common_platform/src_test]
[DEBUG]   (f) compilerId = javac
[DEBUG]   (f) debug = true
[DEBUG]   (f) debuglevel = source,vars,lines
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) failOnError = true
[DEBUG]   (f) forceJavacCompilerUse = false
[DEBUG]   (f) fork = false
[DEBUG]   (f) generatedTestSourcesDirectory = 
/home/acme/trunk_avalon/module/common_platform/target/generated-test-sources/test-annotations
[DEBUG]   (f) mojoExecution = 
org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile {execution: 
default-testCompile}
[DEBUG]   (f) optimize = false
[DEBUG]   (f) outputDirectory = 
/home/acme/trunk_avalon/module/common_platform/build/testClasses
[DEBUG]   (f) project = MavenProject: com.acme:common_platform:0.0.1-SNAPSHOT @ 
/home/acme/trunk_avalon/module/common_platform/pom.xml
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@455fcabc
[DEBUG]   (f) showDeprecation = false
[DEBUG]   (f) showWarnings = false
[DEBUG]   (f) skipMultiThreadWarning = false
[DEBUG]   (f) source = 1.7
[DEBUG]   (f) staleMillis = 0
[DEBUG]   (f) target = 1.7
[DEBUG]   (f) useIncrementalCompilation = false
[DEBUG]   (f) verbose = false
{code}



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

Reply via email to