Maven Archetype
  1. Maven Archetype
  2. ARCHETYPE-334

Run a build on generated project during integration test

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0-alpha-5
    • Fix Version/s: 2.1
    • Component/s: Plugin
    • Labels:
      None

      Description

      Currently it seems that archetype:integration-test just creates some projects from the archetype with defined parameters and compares their contents to "golden" copies. (By the way http://maven.apache.org/archetype/maven-archetype-plugin/integration-test-mojo.html does not document this in any way; I had to read IntegrationTestMojo source to find this out.)

      While that might be useful if you happen to have very complex Velocity templates and need to test that property substitution works the right way with different inputs, most archetypes have rather simple templates that just substitute artifactId and the like, in which case verifying that the created POM matches some fixed text is worse than useless: if you make any changes to the archetype, you are simply going to make identical changes to the test's golden files.

      What would be much more useful in my experience is to check that the newly generated project actually builds. For example, run mvn post-clean verify and check that at a minimum the build completes normally. This would catch common mistakes you might make when editing archetypes: mistyping a plugin or dependency name, introducing compilation errors into Java sources, etc. It would also be valuable to check that no warnings are emitted - such as the infamous File encoding has not been set... message when project.build.sourceEncoding has been forgotten.

      (You could also run mvn post-site, checking for warnings/errors, and compare target/site to a golden copy.)

      CI builders running integration tests might also do so with a pristine local repository (plus cache manager mirroring official public repos), which would catch accidental references to unreleased plugin/dependency versions that the archetype developer happened to have in their local repo.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        325d 3h 31m 1 Hervé Boutemy 21/Aug/11 16:49
        Mark Thomas made changes -
        Workflow jira [ 12953865 ] Default workflow, editable Closed status [ 12991004 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 22:17:37 UTC 2015 [ 1428272257260 ]
        Mark Thomas made changes -
        Workflow jira [ 12716772 ] Default workflow, editable Closed status [ 12748119 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 09:05:55 UTC 2015 [ 1428224755734 ]
        Hervé Boutemy made changes -
        Assignee Herve Boutemy [ hboutemy ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 2.x [ 17632 ]
        Fix Version/s 2.1 [ 16795 ]
        Hide
        Hervé Boutemy added a comment -

        done in r1160058

        Show
        Hervé Boutemy added a comment - done in r1160058
        Hervé Boutemy made changes -
        Fix Version/s 2.1 [ 16795 ]
        Fix Version/s 2.x [ 17632 ]
        Hide
        Hervé Boutemy added a comment -

        typo fixed: thank you for the review

        Show
        Hervé Boutemy added a comment - typo fixed: thank you for the review
        Show
        Jesse Glick added a comment - http://http://jira.codehaus.org/browse/ARCHETYPE-334/ is a typo.
        Hide
        Hervé Boutemy added a comment - - edited

        yes, I discovered it too when reading source code.
        I just improved javadoc in r1004009: please review

        Show
        Hervé Boutemy added a comment - - edited yes, I discovered it too when reading source code. I just improved javadoc in r1004009 : please review
        Hervé Boutemy made changes -
        Field Original Value New Value
        Fix Version/s 2.x [ 16795 ]
        Hide
        Jesse Glick added a comment -

        Interesting, though the proposals there look rather clumsy, and do not appear to implement the "fail on warnings" aspect.

        Show
        Jesse Glick added a comment - Interesting, though the proposals there look rather clumsy, and do not appear to implement the "fail on warnings" aspect.
        Show
        luke w patterson added a comment - some related discussion here: http://maven.40175.n5.nabble.com/unit-testing-archetypes-td75257.html#a75257
        Jesse Glick created issue -

          People

          • Assignee:
            Hervé Boutemy
            Reporter:
            Jesse Glick
          • Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development