Skip to content

Missing groupId in maven packages (<parent> section in pom.xml files not consulted for groupId or version) #30568

Closed
@proxity

Description

@proxity

Description

As defined in https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Example_1

[...], if you want the groupId or the version of your modules to be the same as their parents, you can remove the groupId or the version identity of your module in its POM.

In gitea this triggers a problem. Simple example:

<project>
  <modelVersion>4.0.0</modelVersion>
 
  <parent>
    <groupId>com.mycompany.app</groupId>
    <artifactId>my-app</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>
 
  <artifactId>submodule1</artifactId>
</project>

Since the groupId is only specified in the <parent> section, it's not found and the package gets an empty groupId in its metadata.

See DB:

 id  | package_id | creator_id |   version    | lower_version | created_unix | is_internal |        metadata_json         | download_count 
-----+------------+------------+--------------+---------------+--------------+-------------+------------------------------+----------------
 250 |        113 |         78 | 1.0-SNAPSHOT | 1.0-snapshot  |   1713433435 | f           | {"artifact_id":"submodule1"} |              0

 

The UI shows:

<dependency>
    <groupId></groupId>
    <artifactId>submodule1</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Gitea Version

1.21.10

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

The official docker container

How are you running Gitea?

The official docker container

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions