The archetype plugin goals

So far in this chapter, we have only discussed the generate and crawl goals of the archetype plugin. The following goals are associated with the archetype plugin:

  • archetype:generate: The generate goal creates a Maven project corresponding to the selected archetype. This accepts the archetypeGroupId, archetypeArtifactId, archetypeVersion, filter, interactiveMode, archetypeCatalog, and baseDir arguments. We have already discussed almost all of these arguments in detail.
  • archetype:update-local-catalog: The update-local-catalog goal has to be executed against a Maven archetype project. This will update the local archetype catalogue with the new archetype. The local archetype catalogue is available at ~/.m2/archetype-catalog.xml. We'll use the update-local-catalog goal later in this chapter when we create our own Maven archetype.
  • archetype:jar: The jar goal has to be executed against a Maven archetype project, and it will create a JAR file out of it. This accepts the archetypeDirectory argument, and this contains classes, the finalName argument, the name of the JAR file to be generated, and the outputDirectory argument, which is the location the final output is copied. We'll use the jar goal later in this chapter when we create our own Maven archetype.
  • archetype:crawl: The crawl goal crawls through a local- or a filesystem-based Maven repository (not remote or via HTTP) and creates an archetype catalogue file. This accepts catalogFile as an input parameter, which is the name of the catalogue file to be created. By default, this crawls through the local Maven repository, and to override the location, we need to pass the corresponding repository URL with the repository parameter.
  • archetype:create-from-project: The create-from-project goal creates an archetype project from an existing project. If you compare this with the generate goal, generate creates a new Maven project from scratch corresponding to the selected archetype, while create-from-project creates a Maven archetype project from an existing project. In other words, create-from-project generates a template out of an existing Maven project. We'll discuss the create-from-project goal later in this chapter when we create our own Maven archetype.
  • archetype:integration-test: The integration-test goal will execute the integration tests associated with the Maven archetype project. We'll discuss the integration-test goal later in this chapter when we create our own Maven archetype.
  • archetype:help: The help goal will display the manual associated with the archetype plugin listing out all available goals. If you want to get a detailed description of all the goals, then use the -Ddetail=true parameter along with the command. It is also possible to get the help for a given goal. For example, the following command will display the help associated with the generate goal:
    $ mvn archetype:help -Ddetail=true -Dgoal=generate
    
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.221.144