Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
proxity opened this issue Apr 18, 2024 · 1 comment

Comments

@proxity
Copy link

proxity commented Apr 18, 2024

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 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

@JWT007
Copy link

JWT007 commented Apr 21, 2024

This also affects the sample mvn dependency:get command in the UI

mvn dependency:get -DremoteRepositories=https://gitea-url.com/api/packages/TEST/maven -Dartifact=:my-app:1.0-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants