You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/01/24 14:37:38 UTC

[GitHub] [maven] laeubi opened a new pull request #665: MNG-7395 - Support system-properties in extension.xml

laeubi opened a new pull request #665:
URL: https://github.com/apache/maven/pull/665


   Following this checklist to help us incorporate your
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG) filed
          for the change (usually before you start working on it).  Trivial changes like typos do not
          require a JIRA issue. Your pull request should address just this issue, without
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[MNG-XXX] SUMMARY`, where you replace `MNG-XXX`
          and `SUMMARY` with the appropriate JIRA issue. Best practice is to use the JIRA issue
          title in the pull request title and in the first line of the commit message.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r802526783



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }
     }
 
+    private static Interpolator createInterpolatorFunction( MavenExecutionRequest request )
+    {
+        RegexBasedInterpolator interpolator = new RegexBasedInterpolator();

Review comment:
       Done.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020942506


   @laeubi well there are two comments to this point:
   
   1. it does not justify to use a new way to interpolate values, once again I think we should tend to stick to our own convention and usage and not multiply syntaxes for the same purpose
   2. the extensions are loaded from the clirequest after the env/system props so still the standard interpolation can be used even if part of the project is not available (worse case you just need to adapt `PluginParameterExpressionEvaluator` to ignore the session related variables). I still think trying to read the raw root pom in a fast pass to extract the properties if present since it will be available in most cases and it would enable to use defaults there but not a blocker to me to not have defaults there since `.mvn/jvm.config` enables to set them if needed in all cases.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020982449


   > About the env, I think the env vars are added to properties as `env.<name>` so `EnvarBasedValueSource` is not needed, isnt it? Otherwise ok for me for this part.
   
   EnvarBasedValueSource seems to handel the env. prefix and as it is used at other places it seems fine...
   
   > It is not about me but what you expose to users. I'll present it differently: if you want to support defaults there you must support them everywhere
   
   It could be added to PropertyBasedValueSource if that's useful or we can drop this if that's the only concern.
   
   > You will set `-Dmyprop=mydefault` on the JVM and maven will process the CLI args and override it normally
   
   all right, then this seems a bit like a hidden-feature (to me) so probably we don't need defaults in a strict way, I still think such a syntax would be nice (here) to have everything at one place. But as mentioned before I'm not insist on having default values, it was just an easy to archive option I though bringing some value here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1021015834


   Just meant `EnvarBasedValueSource` being dropped should keep it functional since system properties contain env vars so can avoid the add+lack of exception handling. So +1 to drop and just harness it with a test.
   
   @laeubi don't get me wrong, I'm not strictly against having defaults (and actually a bit more ;)) but I'm against not having it everywhere. So both options are valid for me: drop defaults OR support them everywhere (but this last one will likely break the ecosystem so should be considered with caution since a lot of pom readers will not be aware of it).
   
   BTW thanks a lot for this feature, was maybe not obvious but I think it is a very good one!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1033574397


   > Search for `extensions.xml` [here](https://github.com/apache/maven-integration-testing/tree/master/core-it-suite/src/test/resources). I am certain that at least on IT contains this.
   
   I have created https://github.com/apache/maven-integration-testing/pull/136 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r805194585



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       I do agree, but that should be done separately, outside of this PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r802526633



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }
     }
 
+    private static Interpolator createInterpolatorFunction( MavenExecutionRequest request )
+    {
+        RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
+        interpolator.addValueSource( new PropertiesBasedValueSource( request.getUserProperties() ) );

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1030873907


   > Can this be accompanied with a unit or integration test?
   
   I'm not very familiar with the code-base if you can point me to some tests that do already test the extensions.xml I can try to add one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020793244


   > I don't see the need for that since in the pom you can set in properties `<myextension.version>1.2.3</>` and override it with `-Dmyextension.version` in maven's spirit.
   
   Please take a look at the code and/or [referenced JIRA ](https://issues.apache.org/jira/browse/MNG-7395), at the time the extensions are fetched/created there is no properties, no session, even no "maven".
   If you still think it is possible a small example would be useful (disclaimer: I have already tried this out and got only an warning from maven where it complains that `${myextension.version}` could not be found as a version in any repository) you can use the one I have [attached here](https://issues.apache.org/jira/secure/attachment/13039302/testit.zip) as a starting point.
   
   > Anything else just creates something inconsistent without new real features so better to ensure the "on the fly plugin" is processed as any model instead of making it specific (and lacking env support for ex), no?
   
   Why do you think it is inconsistent? It is what most maven developers would expect and the first thing you have to learn when using core-extensions  with `.mvn/extensions.xml` that they are simply dump and missing all features beside plain text parsing. So I'd like to have *at laest* support for java properties, if one feels env-variables are useful or whatever else that is avaiable at this very early stage, why not, but at the end of the day I'd better have support for "only" system properties instead of no support at all because there are so many other thing one *might* could need and essentially the feature never happens.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o edited a comment on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o edited a comment on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020273161


   > > * If we are going to allow default values, the approach would be a subset of this
   > 
   > So you suggest something like:
   > 
   > `${tycho-version:=2.6.0}`
   > 
   > to have default values?
   
   Rather `parameter:-word`, but depends on the conditions describes in the table.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020930097


   @laeubi `.mvn` only makes sense in the context of a project so it does by design so code must be updated to get the raw model and use standard maven filtering on it IMHO. Don't get me wrong, I understand it is not the current implementation but it is the one we should aim for if we want to support filtering in maven ecosystem I think, others create inconsistencies for users as expained.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r805196083



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       Done!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r805187207



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       Is it guaranteed that `InterpolationException` will have a cause? I guess information will be swallowed here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020960899


   > I now use what maven uses
   
   About the env, I think the env vars are added to properties as `env.<name>` so `EnvarBasedValueSource` is not needed, isnt it? Otherwise ok for me for this part.
   
   > you don't need to use it if you don't like it
   
   It is not about me but what you expose to users. I'll present it differently: if you want to support defaults there you must support them everywhere to ensure all maven filtering is consistent. AFAIK maven community always had been against a mini language for that so I think it is sane to stick to what there is, in particular since inline defaults do not enable any use case for end users as explained.
   
   > there is no other way to express defaults
   
   I explained you it is not true in my previous comment so this part is solved.
   
   > It is only if you don't consider parents and all that stuff
   
   Right, this is what I had in mind but no issue to drop that since it is not really needed, was just convenient.
   
   > The only reference to this seems the wrapper scripts, so is this something specific to the wrapper scripts or why is it not handled by the cli itself?
   
   because it must be set on the JVM before it is launched (think you can configure JUL `LogManager` there for example).
   
   > It also seems to indicate to be reserved for JVM parameter (even though properties are parameters it looks a bit strange) so won't these not be defaults but overrides what is passed on the commandline?
   
   You will set `-Dmyprop=mydefault` on the JVM and maven will process the CLI args and override it normally so think it is ok.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1021045270


   I'll remove the defaults (for now) and just propose a more general approach in a separate PR. I'm really keen to get this in as it bugged me too many times :-D


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o edited a comment on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o edited a comment on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020981377


   Please note that system properties != Maven properties. In Maven 4 the hack of property promotion will likely go away.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r805192161



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       What do you think about simply passing the exception as is here instead of the cause?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020923979






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1030865042


   > Do you want to provide default values through `jvm.config` and then override at the command line?
   
   It seems how it should behave of course one can also give the value at commandline only.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020273161


   > > * If we are going to allow default values, the approach would be a subset of this
   > 
   > So you suggest something like:
   > 
   > `${tycho-version:=2.6.0}`
   > 
   > to have default values?
   
   Rather `parameter:-word`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1022121165


   > Looks like some indentation fix should be done but once fixed PR looks good to me.
   
   I have formatted with the "maven eclipse  profile for eclipse" now and hope everything is fine now, how can we further proceed here? Let me know if there are any issues left. As far as I know I have signed the Individual Contributor License Agreement a while back, how can I check the status here if it is still valid (if necessary)?
   
   In any case I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r800193052



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }
     }
 
+    private static Interpolator createInterpolatorFunction( MavenExecutionRequest request )
+    {
+        RegexBasedInterpolator interpolator = new RegexBasedInterpolator();

Review comment:
       Isn't the `StringSearchInterpolator` enough?
   See `org.apache.maven.model.building.DefaultModelBuilder.interpolateModel(Model, ModelBuildingRequest, ModelProblemCollector)`

##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }
     }
 
+    private static Interpolator createInterpolatorFunction( MavenExecutionRequest request )
+    {
+        RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
+        interpolator.addValueSource( new PropertiesBasedValueSource( request.getUserProperties() ) );

Review comment:
       Please use for consistency reasons `MapBasedValueSource`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1030867157


   > > Do you want to provide default values through `jvm.config` and then override at the command line?
   > 
   > It seems how it should behave of course one can also give the value at commandline only.
   
   To make sure, just try `jvm.config`, I expect it to work.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1030877329


   > > Can this be accompanied with a unit or integration test?
   > 
   > I'm not very familiar with the code-base if you can point me to some tests that do already test the extensions.xml I can try to add one.
   
   Search for `extensions.xml` [here](https://github.com/apache/maven-integration-testing/tree/master/core-it-suite/src/test/resources). I am certain that at least on IT contains this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020812021


   @michael-o I now added the interrogator similar to that method you mentioned
   @rmannibucau It now also support env-variables.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020926678


   > Does `.mvn/extensions.xml` relates to a project?
   
   Not that I'm aware of. At that point of time there are no projects and thus no properties. It behaves as if you put the desired extension into `$MVN_HOME/lib/ext`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020264550


   > * If we are going to allow default values, the approach would be a subset of this
   
   So you suggest something like:
   
   `${tycho-version:=2.6.0}`
   
   to have default values?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020950693


   > 1\. it does not justify to use a new way to interpolate values
   
   As mentioned above I now use what maven uses (or more, whats used on other places), the only extension is the default value, and I think this is valid here as
   
   1. you don't need to use it if you don't like it
   2. there is no other way to express defaults
   
   > 2\. the extensions are loaded from the clirequest after the env/system props so still the standard interpolation
   
   This is already done, see my latest changes and even env variables are possible now
   
   > 2\. I still think trying to read the raw root pom in a fast pass to extract the properties
   
   It is only if you don't consider parents and all that stuff
   
   > 2\. will be available in most cases and it would enable to use defaults there but not a blocker to me to not have defaults there since `.mvn/jvm.config` enables to set them if needed in all cases.
   
   The only reference to this seems the wrapper scripts, so is this something specific to the wrapper scripts or why is it not handled by the cli itself?
   It also seems to indicate to be reserved for JVM parameter (even though properties are parameters it looks a bit strange) so won't these not be defaults but overrides what is passed on the commandline?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020933438


   > only makes sense in the context of a project
   
   Don't think so a core-extension can simply extend everything in maven, even what "project" means ... Just take a look at the [polyglot-extension](https://github.com/takari/polyglot-maven) that allows alternative markup languages instead of pom.xml
   
   Now assume I define my project in terms of json.properties, how should this "project" ever become materialized if the extension required to read it is required to first read the project to get the version property to know what version of the extension should be loaded ... I think its clear that this will never be resolvable...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020981377


   Please not that system properties != Maven properties. In Maven 4 the hack of property promotion will likely go away.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r805194783



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       So should I simply add two catch clauses for this PR?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r805195289



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       Yes, add two please.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020286812


   I don't see the need for that since in the pom you can set in properties `<myextension.version>1.2.3</>` and override it with `-Dmyextension.version` in maven's spirit. Anything else just creates something inconsistent without new real features so better to ensure the "on the fly plugin" is processed as any model instead of making it specific (and lacking env support for ex), no?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] rmannibucau commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020923979


   @laeubi I read the jira and this is why i commented this way. Does `.mvn/extensions.xml` relates to a project? Yes. So it can use the standard maven filtering. The only limitation will be that it is preprocessed, ie you can't use extension enrichment there - by design - but you can use project model so properties and you can use system properties and env variable interpolation as in any part of a maven filtering so no need to invent a new one.
   
   >  It is what most maven developers would expect
   
   I think most maven users will expect filtering to behave as maven filtering, not with a spring/unix/... alternative.
   
   So overall it is very good to bring filtering while it is aligned on maven one and not reimplemented+reinvented IMHO.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1021055899


   I have suashed the commits and using only "standard-maven" now, so I think this is ready for review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020981377


   Please not that system properties != Maven properties. In Maven 4 the hack of property promotion will likely go away.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020793244






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1030867239


   Can this be accompanied with a unit or integration test?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] laeubi commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
laeubi commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r805192161



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       What do you think about simply passing the exception as is here instead of the cause?

##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       So should I simply add two catch clauses for this PR?

##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       Done!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o commented on a change in pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #665:
URL: https://github.com/apache/maven/pull/665#discussion_r805187207



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       Is it guaranteed that `InterpolationException` will have a cause? I guess information will be swallowed here.

##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       I do agree, but that should be done separately, outside of this PR.

##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
##########
@@ -127,30 +134,39 @@ private CoreExtensionEntry createExtension( CoreExtension extension, List<Artifa
     }
 
     private List<Artifact> resolveExtension( CoreExtension extension, RepositorySystemSession repoSession,
-                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter )
+                                             List<RemoteRepository> repositories, DependencyFilter dependencyFilter,
+                                             Interpolator interpolator )
         throws ExtensionResolutionException
     {
         try
         {
             // TODO: enhance the PluginDependenciesResolver to provide a
-            // TODO:    resolveCoreExtension method which uses a CoreExtension
-            // TODO:    object instead of a Plugin as this makes no sense
+            // TODO: resolveCoreExtension method which uses a CoreExtension
+            // TODO: object instead of a Plugin as this makes no sense
             Plugin plugin = new Plugin();
-            plugin.setGroupId( extension.getGroupId() );
-            plugin.setArtifactId( extension.getArtifactId() );
-            plugin.setVersion( extension.getVersion() );
+            plugin.setGroupId( interpolator.interpolate( extension.getGroupId() ) );
+            plugin.setArtifactId( interpolator.interpolate( extension.getArtifactId() ) );
+            plugin.setVersion( interpolator.interpolate( extension.getVersion() ) );
 
-            DependencyNode root = pluginDependenciesResolver
-                    .resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
+            DependencyNode root =
+                pluginDependenciesResolver.resolveCoreExtension( plugin, dependencyFilter, repositories, repoSession );
             PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
             root.accept( nlg );
 
             return nlg.getArtifacts( false );
         }
-        catch ( PluginResolutionException e )
+        catch ( PluginResolutionException | InterpolationException e )
         {
             throw new ExtensionResolutionException( extension, e.getCause() );
         }

Review comment:
       Yes, add two please.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] michael-o edited a comment on pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
michael-o edited a comment on pull request #665:
URL: https://github.com/apache/maven/pull/665#issuecomment-1020981377


   Please note that system properties != Maven properties. In Maven 4 the hack of property promotion will likely go away.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven] asfgit closed pull request #665: MNG-7395 - Support system-properties in extension.xml

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #665:
URL: https://github.com/apache/maven/pull/665


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org