Skip to content

Pipeline for Maven#1953

Open
chinyeungli wants to merge 112 commits into
mainfrom
1763_pipeline_for_maven
Open

Pipeline for Maven#1953
chinyeungli wants to merge 112 commits into
mainfrom
1763_pipeline_for_maven

Conversation

@chinyeungli

@chinyeungli chinyeungli commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
- Update format

Signed-off-by: Chin Yeung Li <tli@nexb.com>
@chinyeungli
chinyeungli requested a review from tdruez November 13, 2025 10:40
Comment thread scanpipe/pipes/resolve.py Fixed
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Comment thread scanpipe/pipes/resolve.py Fixed
…1763

- Update package's license if missing while the same package has license detected in RESOURCES

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>

@tdruez tdruez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Create a new maven pipe module in place of use resolve
  • Opening and loading a large file to make edits multiple times in various steps is not great.
  • To be discussed: Do we need a dedicated pipeline for just an extra step? Shouldn't the original scan_single_package detect that it's a Maven package and apply the necessary? Any reason to keep this new logic separated?

Comment thread scanpipe/pipelines/scan_maven_package.py Outdated
Comment thread scanpipe/pipelines/scan_single_package.py Outdated
Comment thread scanpipe/pipelines/scan_single_package.py Outdated
Comment thread scanpipe/pipes/resolve.py Outdated
Comment thread scanpipe/pipes/resolve.py Outdated
Signed-off-by: Chin Yeung Li <tli@nexb.com>
- Create a new maven pipe module
- Use database queries for update_package_license_from_resource_if_missing()
- Add tests

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
@chinyeungli

Copy link
Copy Markdown
Contributor Author

@tdruez I’ve updated the code to include support for the "D2D" option.

Screenshot 2025-12-29 113240

The "deploy_to_devel" option is equivalent to the "map_deploy_to_develop" pipeline, which runs on Java, JavaScript, Kotlin, and Scala as these are the languages commonly found in Maven projects.

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
@chinyeungli
chinyeungli requested a review from tdruez January 28, 2026 03:31
@TG1999
TG1999 self-requested a review May 1, 2026 09:08
Some projects encountered a unique constraint violation when a resource
was already mapped:
```
duplicate key value violates unique constraint "scanpipe_codebaserelation_unique_relation"
DETAIL:  Key (from_resource_id, to_resource_id, map_type)=(1512780, 1512790, jar_to_source) already exists.
```

Signed-off-by: Chin Yeung Li <tli@nexb.com>
tdruez and others added 8 commits July 14, 2026 10:32
Signed-off-by: tdruez <tdruez@aboutcode.org>
Signed-off-by: tdruez <tdruez@aboutcode.org>
- Remove unnecessary code
- Override the default "download_inputs" action
- Accept only a single Maven PURL as input
- Perform a D2D scan by default if both binary and source are available
- Update tests

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
* Require for `"tab_context": {"VULNERABLECODE_URL": settings.VULNERABLECODE_URL},`

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung <tli@nexb.com>
@chinyeungli

Copy link
Copy Markdown
Contributor Author

I've redesigned the code. It now only takes 1 PURL as input.
I've also removed the manual option for d2d. If both the source and binary are available, d2d will be performed automatically, otherwise, only a basic scan is performed.

Example 1:
PURL: pkg:maven/aero/champ/cargojson@1.0
Screenshot 2026-07-14 102531

Without fetching the remote POM and updating the package data, no packages are detected because the fetched binary (https://repo1.maven.org/maven2/aero/champ/cargojson/1.0/cargojson-1.0.jar) doesn't contain a pom.xml.

However, with remote POM fetching and package data updates enabled, we successfully detect 1 package and update 17 dependencies in the summary:
Screenshot 2026-07-14 102430
Screenshot 2026-07-14 102457
Screenshot 2026-07-14 102509
(We can see the POM file was fetched remotely under "Datafile paths".)

Example 2:
PURL: pkg:maven/activemq/activemq-axis@1.2
https://repo1.maven.org/maven2/activemq/activemq-axis/1.2/

Since there is no source available for this package, only a basic scan is performed.
Screenshot 2026-07-14 102622

* Require for `"tab_context": {"VULNERABLECODE_URL": settings.VULNERABLECODE_URL},`

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Comment thread scanpipe/pipelines/scan_maven_package.py Outdated
Comment thread scanpipe/pipes/maven.py Outdated
Comment thread scanpipe/pipes/maven.py Outdated
{% endfor %}
</ul>
{% endif %} No newline at end of file
{% endif %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unwanted change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was likely auto‑corrected when I ran make check, but in any case the missing tag has now been added and fixed.

{% endfor %}
</tbody>
</table> No newline at end of file
</table>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unwanted change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was likely auto‑corrected when I ran make check, but in any case the missing tag has now been added and fixed.

Comment thread scanpipe/pipes/maven.py Outdated
Comment thread scanpipe/pipes/maven.py
Comment thread scanpipe/pipes/maven.py Outdated
Comment thread scanpipe/pipelines/scan_maven_package.py Outdated
Comment thread scanpipe/pipelines/scan_maven_package.py Outdated
chinyeungli and others added 3 commits July 16, 2026 17:54
Co-authored-by: tdruez <489057+tdruez@users.noreply.github.com>
Signed-off-by: Chin Yeung <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
@chinyeungli
chinyeungli requested a review from tdruez July 17, 2026 07:09
Comment thread scanpipe/pipelines/scan_maven_package.py Outdated
Comment thread scanpipe/pipelines/scan_maven_package.py Outdated
else:
self.extract_inputs_to_codebase_directory()

def maven_d2d_steps(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the method after the d2d_* ones for a more natural reading hierarchy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does that mean?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cut and paste this method after d2d_process for better readability

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no problem doing that, but don’t we want the methods’ order to follow the steps’ order?

Comment thread scanpipe/pipelines/scan_maven_package.py Outdated
Comment thread scanpipe/pipes/maven.py Outdated
Comment thread scanpipe/pipes/maven.py Outdated
Comment thread scanpipe/pipes/maven.py Outdated
Comment thread scanpipe/pipes/maven.py Outdated
Comment thread scanpipe/tests/pipes/test_maven.py Outdated
self.assertEqual(0, project1.discoveredpackages.count())

@skipIf(sys.platform == "darwin", "Not supported on macOS")
def test_scanpipe_scan_maven_package_single_file(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing

chinyeungli and others added 2 commits July 20, 2026 15:00
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Co-authored-by: tdruez <489057+tdruez@users.noreply.github.com>
Signed-off-by: Chin Yeung <tli@nexb.com>
@chinyeungli
chinyeungli requested a review from tdruez July 20, 2026 10:24

@tdruez tdruez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chinyeungli a few issues still need to be addressed. Please also add or update unit tests to cover them, so we catch regressions on those.

Comment thread scanpipe/pipelines/scan_maven_package.py Outdated
Comment thread scanpipe/pipes/maven.py
Comment thread scanpipe/pipes/maven.py
Comment thread scanpipe/pipes/maven.py
Comment thread scanpipe/pipes/maven.py
Comment thread scanpipe/pipes/maven.py Outdated
Comment thread scanpipe/tests/pipes/test_maven.py Outdated
Comment thread pyproject.toml
Comment thread scanpipe/pipes/maven.py
Signed-off-by: Chin Yeung Li <tli@nexb.com>
* Better error handling
* Fix update_scan_data to append rather than overwrite existing dependencies
* Improve perfomance for update_package_license_from_resource_if_missing()

Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
@chinyeungli
chinyeungli force-pushed the 1763_pipeline_for_maven branch from 68dc17b to 62a29ac Compare July 23, 2026 04:25
@chinyeungli
chinyeungli requested a review from tdruez July 23, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.