maven-incremental-build
  1. maven-incremental-build
  2. MAVEN_INCREMENTAL_BUILD-12

Plugin looks for a resources directory in POM modules where it is not necessary

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5
    • Component/s: modification detection
    • Labels:
      None
    • Environment:

      Ubuntu 11.04, Maven 2.2.1

      Description

      I am running Maven Incremental Build on a multi-module project. The parent module does not have a src/resources or src/java directory because it is a POM module.

      When the plugin executes, it says that src/resources is not found also also states that a resource has been deleted, and therefore it cleans the parent module, which leads to a full build instead of an incremental build.

      Output from Plugin :

      [INFO] ------------------------------------------------------------------------
      [INFO] Building XXXX
      [INFO] task-segment: [install]
      [INFO] ------------------------------------------------------------------------
      [INFO] [incremental-build:incremental-build

      {execution: default}

      ]
      [INFO] Verifying module descriptor ...
      [INFO] Verifying parent modules...
      [INFO] Verifying resources...
      [INFO] Resources directory does not exist : /home/yohan/workspace/XXXX/src/main/resources
      [INFO] A resource was deleted, module have to be cleaned
      [INFO] Deleting /home/yohan/workspace/XXXX/target
      [INFO] [site:attach-descriptor

      {execution: default-attach-descriptor}

      ]
      [INFO] [install:install

      {execution: default-install}

      ]
      [INFO] Installing /home/yohan/workspace/XXX/pom.xml to /home/yohan/.m2/repository/XXXX/0.0.1-SNAPSHOT/XXXX-0.0.1-SNAPSHOT.pom

        Activity

        Hide
        mrleit added a comment - - edited

        I have been testing the 1.6 release and have noted that there seems to still be a slight issue with testResource directory.

        The project is being cleaned in much the same way as previously because of the src/resource directory, however this time it is caused by test/resource.

        Here is the log illustrating the problem.

        [DEBUG] Last source modification : 1330697787162
        [DEBUG] Target directory : xxx\target\classes
        [DEBUG] Scanning output directory...
        [DEBUG] Target files : [ xxx ]
        [DEBUG] Last target modification date : 1331031355849
        [DEBUG] No timestamp changes detected.
        [DEBUG] Saving source list
        [DEBUG] Saving file xxx\target\test-classes\testsList ...
        [INFO] Verifying tests resources...
        [INFO] Verifying test resources...
        [DEBUG] Using file : xxx\target\testResourcesList
        [DEBUG] Previous file xxx\target\testResourcesList not found.
        [DEBUG] Using file : xxx\target\testResourcesList
        [DEBUG] Resources excludes : []
        [DEBUG] Resources includes : []
        [INFO] Resources directory does not exist : xxx\src\test\resources
        [DEBUG] Saving file xxx\target\testResourcesList ...
        [DEBUG] test update detected : true
        [DEBUG] Module updated, cleaning module
        [INFO] Deleting xxx\target
        [DEBUG] Saving timestamps..
        [DEBUG] Saving file xxx\target\timestamp ...
        

        I have manually added an empty resource directory to test folder to workaround this issue. But we have dozens of projects that don't have and don't require this directory.

        Show
        mrleit added a comment - - edited I have been testing the 1.6 release and have noted that there seems to still be a slight issue with testResource directory. The project is being cleaned in much the same way as previously because of the src/resource directory, however this time it is caused by test/resource. Here is the log illustrating the problem. [DEBUG] Last source modification : 1330697787162 [DEBUG] Target directory : xxx\target\classes [DEBUG] Scanning output directory... [DEBUG] Target files : [ xxx ] [DEBUG] Last target modification date : 1331031355849 [DEBUG] No timestamp changes detected. [DEBUG] Saving source list [DEBUG] Saving file xxx\target\test-classes\testsList ... [INFO] Verifying tests resources... [INFO] Verifying test resources... [DEBUG] Using file : xxx\target\testResourcesList [DEBUG] Previous file xxx\target\testResourcesList not found. [DEBUG] Using file : xxx\target\testResourcesList [DEBUG] Resources excludes : [] [DEBUG] Resources includes : [] [INFO] Resources directory does not exist : xxx\src\test\resources [DEBUG] Saving file xxx\target\testResourcesList ... [DEBUG] test update detected : true [DEBUG] Module updated, cleaning module [INFO] Deleting xxx\target [DEBUG] Saving timestamps.. [DEBUG] Saving file xxx\target\timestamp ... I have manually added an empty resource directory to test folder to workaround this issue. But we have dozens of projects that don't have and don't require this directory.
        Hide
        mrleit added a comment - - edited

        I was looking at this same problem, and because it was occurring at the top level of our hierarchy it caused the entire structure to rebuild.

        I checked out trunk and I believe I isolated and fixed the problem, which was that the resourcesList file was never created due to an incorrect logic statement.

        In IncrementalBuildMojo.java in resourcesUpdated() at the end...

        
        	if (previousResources.isEmpty()) {
        		getLog().info("A resource was deleted, module have to be cleaned");
        		return true;
        	}
        	try {
        		actualResources.save();
        	} catch (IOException e) {
        		getLog().warn("Error saving resource files list", e);
        		return true;
        	}
        	return false;
        

        where it checks that previousResources is empty. I believe it should be checking that it is not empty !isEmpty(). PreviousResources is the list of resources - (minus) the current files in the resource directory. If anything is left in this list, then something was deleted.

        After this is fixed, the method correctly writes the actual resources file.

        This also causes the resource unit test to fail... and I believe it never worked properly anyway.

        I've Ignored it for now.

        Behaviour of the plugin appears to be as expected now.

        Show
        mrleit added a comment - - edited I was looking at this same problem, and because it was occurring at the top level of our hierarchy it caused the entire structure to rebuild. I checked out trunk and I believe I isolated and fixed the problem, which was that the resourcesList file was never created due to an incorrect logic statement. In IncrementalBuildMojo.java in resourcesUpdated() at the end... if (previousResources.isEmpty()) { getLog().info( "A resource was deleted, module have to be cleaned" ); return true ; } try { actualResources.save(); } catch (IOException e) { getLog().warn( "Error saving resource files list" , e); return true ; } return false ; where it checks that previousResources is empty. I believe it should be checking that it is not empty !isEmpty(). PreviousResources is the list of resources - (minus) the current files in the resource directory. If anything is left in this list, then something was deleted. After this is fixed, the method correctly writes the actual resources file. This also causes the resource unit test to fail... and I believe it never worked properly anyway. I've Ignored it for now. Behaviour of the plugin appears to be as expected now.

          People

          • Assignee:
            vsellier
            Reporter:
            yohanliyanage
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: