amclin / aem-packager

A node plugin that creates AEM packages installable through the Adobe Experience Manager package manager.
MIT License
16 stars 4 forks source link

Reduce extraneous maven warnings in build log #29

Open amclin opened 5 years ago

amclin commented 5 years ago

Is your feature request related to a problem? Please describe. Having extraneous warnings in logs makes it harder to identify problems. Running this plugin generates maven warnings that can probably be avoided.

Describe the solution you'd like Maven warns against having dynamic values in specific properties to reduce the risk of generating malformed packages. The normal expectation is that these properties are defined explicitilty as the pom.xml is the source of truth. However, since this plugin moves the responsibility of the source of truth outside of Maven to the NPM package, they must be dynamically populated.

Investigate alternative approaches to specifying these required details without triggering warnings. A few options could include

  1. Changing how variables are used in the pom.xml to not rely on package properties
  2. Generating temporary static pom.xml files instead of using Maven variables

Additional context Maven log:

Starting AEM Packager.
Processing list of Defines.
Generating a default JCR installation path.
Package contents will be installed to /apps/com.github.amclin/npm-packager-example/clientlibs
Running AEM Packager for com.github.amclin.npm-packager-example
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.github.amclin:npm-packager-example:content-package:1.0.0
[WARNING] 'groupId' contains an expression but should be a constant. @ ${npmgroupId}:${npmartifactId}:${npmversion}, /Users/amclin/git/aem-packager/src/pom.xml, line 10, column 11
[WARNING] 'artifactId' contains an expression but should be a constant. @ ${npmgroupId}:${npmartifactId}:${npmversion}, /Users/amclin/git/aem-packager/src/pom.xml, line 11, column 14
[WARNING] 'version' contains an expression but should be a constant. @ ${npmgroupId}:${npmartifactId}:${npmversion}, /Users/amclin/git/aem-packager/src/pom.xml, line 12, column 11
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
amclin commented 2 years ago

For users with Maven 3.2.1 and later, the message specifically for version can be eliminated by replacing ${npmversion} with a property named ${revision}. Several 'allowed' properties have been created, but only for use in the <version> field.

This doesn't solve groupId or artifactId

Alternatively we could temporarily copy the pom.xml and do string replacement instead of using Maven's properties system, but that is such a messy approach.