Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have <packaging>jar</packaging> in a parent pom file?

I am trying to not reinvent the wheel here with my POM files. I have a pom that I am trying to convert into a parent pom.xml file in maven.

The project is setup as the following structure:

    core
    |
     ---- pom.xml
    |
     ---- Proj A
          | 
           ---- <parent> pom.xml
          |
          Proj A - module 1
          |
           ---- pom.xml
          |
          Proj A - module 2
          |
           ---- pom.xml
   |
    ---- Proj B
         |
          ---- pom.xml

I have everything seemingly set up correctly, except something is throwing me off. I have this defined in the cor pom.xml file:

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.imx.core</groupId>
    <artifactId>imx-core</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
<modules>
    <module>Proj A</module>
    <module>Proj B</module>
</modules>

It all seems to build except the imx-core artifact, which it's putting in the .m2 repo. Since the packaging is no longer "jar" but now "pom", how would I go about creating the jar package from the core's pom file?

The long way to do it (I'm assuming) is to create a completely new pom which is a dedicated parent and child out all the other poms? If this could be done in the existing core/pom.xml file that would be better. Or am I not thinking about this the right way?

like image 552
ResourceReaper Avatar asked Oct 06 '22 18:10

ResourceReaper


1 Answers

I'm not sure exactly where you have the problem, but note that multi-module projects (POMs with a modules section) and parent POM projects (POMs with pluginManagement and/ or dependencyManagement sections) should have the packaging type "pom" and should not contain any source code (except things like LICENSE.txt, README.txt, CHANGES.txt, assembly configs etc.).

like image 65
Puce Avatar answered Oct 10 '22 01:10

Puce