Java – how do I test the Maven prototype I just created?

I've created several prototypes for projects that work now, but I want to be able to verify that the code generated from the prototype will continue to work in the future

What I want is a stage of prototype construction. It uses the prototype just created, runs MVN archetype: generate, and then runs MVN verification on the generated code to verify whether the generated code is indeed normal If necessary, I will write my own mojo to do this, but I want to see if a solution already exists I saw the prototype: integration test goal, but it didn't seem to do what I wanted

Solution

Update 2013: now it's much easier than other answers suggest

http://jira.codehaus.org/browse/ARCHETYPE-334 Completed in August 2011

To use it, simply install word on the goal Txt file, and the tests from your prototype project will be called as part of the normal build (and / or in the case of OP)

However, if the prototype you just proposed realizes that this popular Mini Guide is outdated and will be used for prototyping, prototype integration tests will not be run You should create an archetype metadata as described here XML files (as well as using filesets)

Also note that these integration tests do not respond to - dskiptests, but can be remedied as follows:

<build>
  <plugins>

    <plugin>
      <artifactId>maven-archetype-plugin</artifactId>
      <version>2.2</version>
      <configuration>
        <skip>${skipTests}</skip>
      </configuration>        
    </plugin>

  </plugins>
</build>

(although this looks like skipping the entire plug-in, it may actually be because it returns to the traditional mode, and I can't find any successful way to skip the integration test target execution using only the above code.)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>