Skip to content

Maven model 4.1.0 allows non-pom packaging for aggregators #11160

Closed

Description

@zulkar

Affected version

4.0.0-rc4

Bug description

Consider simple project, parent and child

pom.xml:

   <modelVersion>4.1.0</modelVersion>
    <groupId>org.example</groupId>
    <artifactId>parent</artifactId>
    <version>1/version>
    <packaging>jar</packaging>
    <subprojects>
        <subproject>child</subproject>
    </subprojects>

child/pom.xml

<!--
<parent>
        <groupId>org.example</groupId>
        <artifactId>parent</artifactId>
        <version>1</version>
    </parent>
-->
<modelVersion>4.1.0</modelVersion>
 <groupId>org.example</groupId>
 <version>1</version>
 <artifactId>child</artifactId

Please notice, that child/pom.xml do not declare parent.

lets consider scenarios.

  1. Model 4.0.0, tag: Build fails with: 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. This is good old behaviour
  2. Model 4.1.0, tag: Again, build fails with: 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. This is good old behaviour
  3. Model 4.1.0, tag: Build passes. This looks a bit strange for me and contradicts with scenario Use Eclipse/Sisu 0.0.0.M2 milestone #2. Also, in this scenario src/main/java is also being compiled. We can fail the build, e.g. creating src/main/java/Main.java with syntax error

So, the issue is: In model 4.1.0 now it is possible to build jar from an aggregator project. OR, in another words, aggregator projects can have any packaging, not only"pom" if they use tag.

Is it an expected behavoir? If yes, we will fix our expectations in IDEA.

PS: For the record:
Intellij failing test:
https://github.com/JetBrains/intellij-community/blob/0a34a44dc81e58ba9788b41a3b3e279c38648700/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/InvalidProjectImportingTest.kt#L383

Activity

  1. zulkar commented on Sep 23, 2025

    @zulkar
    Author

    Sorry, markdown ate tags.

    Should be:

    Model 4.0.0, tag modules: Build fails with: 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. This is good old behaviour
    Model 4.1.0, tag modules: Again, build fails with: 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. This is good old behaviour
    Model 4.1.0, tag subprojects: Build passes. This looks a bit strange for me and contradicts with scenario 2 . Also, in this scenario src/main/java is also being compiled.

  2. self-assigned this
    on Oct 16, 2025
  3. added a commit that references this issue on Oct 16, 2025
    1dd329b
  4. added 4 commits that reference this issue on Oct 16, 2025
    e60d230
    427d4ba
    6a721a0
    629ade0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions