Jared Roberts created ARCHETYPE-409:
---------------------------------------

             Summary: IntegrationTestMojo deletes project folder before test.
                 Key: ARCHETYPE-409
                 URL: https://jira.codehaus.org/browse/ARCHETYPE-409
             Project: Maven Archetype
          Issue Type: Bug
          Components: Plugin
    Affects Versions: 2.2
            Reporter: Jared Roberts
         Attachments: partial-archetype-example.zip

I am attempting to integration test a "partial" archetype by including a valid 
POM inside the test project. The test fails to generate the expected output 
because prior to running the test, a call to FileUtils.deleteDirectory() is 
made to delete all files in the test basedir. I believe the intent of 
performing the deletion is to clean up prior test runs, but this makes testing 
partial archetypes impossible with the maven-archetype-plugin.

A couple possible solutions exist. The first would be to stop deleting the 
basedir before testing. This might be surprising if someone forgets to clean 
between tests, but is that really a valid use-case? The second option that I 
can think of would be to add a new conventional directory ("expected"?) where 
the test project files can be placed and the Archetype plugin will check if 
that directory exists and copy the contents to the "project" folder after 
cleaning up. This option seems like a good compromise because it allows tests 
to succeed without an explicit "clean" between and also allows testing of 
partial archetypes.

I've attached an example archetype that demonstrates the behavior I'm 
describing. Notice that the output from both the "empty" and "existing" 
projects are the same.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to