You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/09/22 14:35:00 UTC
[jira] [Commented] (MNG-6437) Generic .uri suffix to get the URI representation of any file property
[ https://issues.apache.org/jira/browse/MNG-6437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17768042#comment-17768042 ]
ASF GitHub Bot commented on MNG-6437:
-------------------------------------
gnodet commented on code in PR #812:
URL: https://github.com/apache/maven/pull/812#discussion_r1334466167
##########
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorV4.java:
##########
@@ -343,13 +352,13 @@ else if ( expression.startsWith( "settings" ) )
if ( pathSeparator > 0 )
{
- String pathExpression = expression.substring( 1, pathSeparator );
+ String pathExpression = expression.substring( 0, pathSeparator );
value = ReflectionValueExtractor.evaluate( pathExpression, session.getSettings() );
value = value + expression.substring( pathSeparator );
}
else
{
- value = ReflectionValueExtractor.evaluate( expression.substring( 1 ), session.getSettings() );
+ value = ReflectionValueExtractor.evaluate( expression, session.getSettings() );
}
}
catch ( Exception e )
Review Comment:
I've extracted those changes in a different PR.
> Generic .uri suffix to get the URI representation of any file property
> ----------------------------------------------------------------------
>
> Key: MNG-6437
> URL: https://issues.apache.org/jira/browse/MNG-6437
> Project: Maven
> Issue Type: Improvement
> Components: Core
> Affects Versions: 3.5.4
> Reporter: Claude Brisson
> Assignee: Guillaume Nodet
> Priority: Major
> Fix For: 4.0.x-candidate, 4.0.0
>
>
> It's impossible to properly generate, for instance, a java policy file which needs files URIs, using either Cargo properties and filtered config files, or just filtered resources.
> In both cases, the problem is the impossibility to generate proper URIs when expanding Maven properties (see also MNG-3760).
> The candidate feature is to add a way to explicitly request the URI when expanding a property by means of a {{.uri}} suffix. The underlying {{getUri()}} method should rely on the correct {{Path#toUri()}} and neither {{File#toUri()}} nor {{File#toString()}}, see the SO reference in MNG-6386.
> For instance:
> * {{${project.basedir.uri}}} instead of the broken {{${project.baseUri}}} (and of course fix MNG-6436 otherwise it's useless)
> * {{${project.build.directory.uri}}}
> * {{${settings.localRepository.uri}}}
> * etc
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)