Maven does not properly track class files to be included in jar/test breaking 
incremental build
-----------------------------------------------------------------------------------------------

                 Key: MNG-5039
                 URL: http://jira.codehaus.org/browse/MNG-5039
             Project: Maven 2 & 3
          Issue Type: Bug
          Components: Bootstrap & Build
    Affects Versions: 3.0, 2.2.1
            Reporter: Emil Sit
            Priority: Critical


When files in the source tree (either src/main or src/test) are renamed or 
removed, the class files resulting from their prior compilation remain in the 
corresponding target/ directories.  It seems that surefire and package plugins 
simply grab everything from target/ and as a result, incremental builds are not 
correct.  For example,

* If you remove a test source file and the test will continue to run. This is 
bad esp when the test is failing; packaging will fail even though it should not.
* If you remove/rename a source file and the class file will continue to be in 
the jar.  This may cause tests to succeed even though they should not.  (And if 
you share the jar, this will affect downstream non-test dependencies.)

I wrote up a test suite for the second case and put it up at 
https://github.com/sit/java-build-test. To run it ...

   git clone git://github.com/sit/java-build-test.git
   cd java-build-test
   sh runme.sh

(It does rely on git to automate the rename/delete actions though so a tar of 
the sources won't work.)
In addition to Maven, it tests Gradle (which works) and Buildr (which behaves 
the same as Maven).

While incremental builds are not the recommendation for official deliverables, 
this does make Maven appear extremely unreliable to developers who never know 
after syncing whether they will have to do a clean build or if an incremental 
one is correct.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to