Building a pom project

There are many reasons why you may want to make a pom file available as an artifact. One reason is the aggregate project. An aggregate project must have the pom packaging type. Another reason could be a pom, which can be imported as a dependency. Whatever the reason, Maven provides support to build a pom project.

How to do it...

  1. Open a simple pom project (simple-pom-project).
  2. Observe the packaging type:
    <groupId>com.packt.cookbook</groupId>
        <artifactId>simple-pom-project</artifactId>
        <packaging>pom</packaging>
        <version>1.0-SNAPSHOT</version>
        <description>Simple pom project</description>
  3. Build the project:
    mvn clean package
    

    Note that only the clean goal is run.

  4. Run the following command:
        mvn clean install 
    
  5. Observe the output:

How ...

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.