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

Fixed & refactored loading pom.properties #727

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

Nikemare
Copy link
Contributor

@prabhu fixed & refactored loading pom.properties. If you can provide the link to the jar file which included 'META-INF/maven/extension.xml' I can add it to the test as well.

Signed-off-by: Nikemare <102925451+Nikemare@users.noreply.github.com>
@prabhu
Copy link
Collaborator

prabhu commented Nov 20, 2023

Signed-off-by: Nikemare <102925451+Nikemare@users.noreply.github.com>
@Nikemare
Copy link
Contributor Author

@prabhu Thanks for the link. Updated the repotest for standalone-jar-files.

}
}
}
const pomProperties = getPomPropertiesFromMavenDir(mavenDir);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since pomProperties can be an empty object, do we need a condition to skip?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Apologies, it might be right below this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it is an empty object (e.g. wsdl4j-1.6.3.jar) group, name and version will be undefined, but this case is handled later.

const pomPropertiesString = readFileSync(pomPropertiesFile, {
encoding: "utf-8"
});
pomProperties = parsePomProperties(pomPropertiesString);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need a break or return here since this is inside a loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately a return/break does not work with forEach. But usually the jar should anyway contain one directory on each level inside the META-INF/maven directory. And as I learned optionally the extension.xml. Therefore I thought we can keep the implementation that way, because there will be no performance loss.

@Nikemare
Copy link
Contributor Author

repotest for standalone jar files takes still 2 seconds:

╔═══════════════════════════╤═════════════════════════════════════╤═══════════════════════════╤═════════════════╗
║ Group                     │ Name                                │                   Version │ Scope           ║
╚═══════════════════════════╧═════════════════════════════════════╧═══════════════════════════╧═════════════════╝
╟───────────────────────────┼─────────────────────────────────────┼───────────────────────────┼─────────────────╢
║ org.apache.ws.xmlschema   │ xmlschema-core                      │                     2.2.5 │                 ║
╚═══════════════════════════╧═════════════════════════════════════╧═══════════════════════════╧═════════════════╝
╟───────────────────────────┼─────────────────────────────────────┼───────────────────────────┼─────────────────╢
║ wsdl4j                    │ wsdl4j                              │                     1.6.3 │                 ║
╚═══════════════════════════╧═════════════════════════════════════╧═══════════════════════════╧═════════════════╝
╟───────────────────────────┼─────────────────────────────────────┼───────────────────────────┼─────────────────╢
║ org.jacoco                │ org.jacoco.report                   │                     0.8.8 │                 ║
╚═══════════════════════════╧═════════════════════════════════════╧═══════════════════════════╧═════════════════╝
╟───────────────────────────┼─────────────────────────────────────┼───────────────────────────┼─────────────────╢
║ org.apache.maven          │ maven-core                          │                     3.9.2 │                 ║
╚═══════════════════════════╧═════════════════════════════════════╧═══════════════════════════╧═════════════════╝
╟───────────────────────────┼─────────────────────────────────────┼───────────────────────────┼─────────────────╢
║ junit                     │ junit                               │                    4.13.2 │                 ║
╚═══════════════════════════╧═════════════════════════════════════╧═══════════════════════════╧═════════════════╝
╟───────────────────────────┼─────────────────────────────────────┼───────────────────────────┼─────────────────╢
║ com.fasterxml.jackson.cor │ jackson-core                        │                    2.16.0 │                 ║
║ e                         │                                     │                           │                 ║
╚═══════════════════════════╧═════════════════════════════════════╧═══════════════════════════╧═════════════════╝
BOM includes 6 components and 0 dependencies

@prabhu prabhu merged commit 0e65ee5 into CycloneDX:master Nov 20, 2023
17 checks passed
@Nikemare Nikemare deleted the fix-locating-pom-properties-file branch November 20, 2023 20:34
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.

2 participants