OpenLiberty / ci.common

Common functionality for ci.maven and ci.gradle
Apache License 2.0
3 stars 30 forks source link

provide better error message for prepare feature #415

Closed jjiwooLim closed 1 year ago

jjiwooLim commented 1 year ago

Addressing https://github.com/OpenLiberty/ci.maven/issues/1615.

Provide better error message when prepare-feature or prepareFeature task failed to generate features.json file for user feature(s).

In most cases, errors are caused by missing artifact properties in features-bom file (ex. <type>esa</type>) or wrong coordinates infeature-A.esa.pom, if it exists. If there is a pom file for the feature esa file, then it will read the pom file first and check if the esa exists in specified cooridinate. If the pom file doesn't exist, then it will directly check the esa file specified in features-bom file.

jjiwooLim commented 1 year ago

Updated error message: If ESA file missing:

[INFO] --- liberty-maven-plugin:3.8.3-SNAPSHOT:prepare-feature (default-cli) @ liberty-maven-plugin-demo1 ---
[WARNING] org.apache.maven.plugin.MojoExecutionException: Unable to resolve artifact: test.user.test.osgi:SimpleActivatorESA:1.0.0-SNAPSHOT
[WARNING] The features.json could not be generated due to errors encountered while resolving the feature ESA file specified in feautres-bom file at coordinates test.user.test.osgi:features-bom:0.0.1-SNAPSHOT

If there's error in features-bom file:

[WARNING] Error: [type] tag(s) not found in features-bom file /Users/jiwoolim/.m2/repository/test/user/test/osgi/features-bom/0.0.1-SNAPSHOT/features-bom-0.0.1-SNAPSHOT.pom
[WARNING] The features.json could not be generated due to errors encountered while resolving the feature ESA file specified in feautres-bom file at coordinates test.user.test.osgi:features-bom:0.0.1-SNAPSHOT

If features-bom missing:

[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.8.3-SNAPSHOT:prepare-feature (default-cli) on project liberty-maven-plugin-demo1: Error preparing features.: org.apache.maven.plugin.MojoExecutionException: Unable to resolve artifact: test.user.test.osgi:features-bom:0.0.1-SNAPSHOT: Could not find artifact test.user.test.osgi:features-bom:pom:0.0.1-SNAPSHOT -> [Help 1]