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 2022/08/26 04:38:00 UTC

[jira] [Commented] (MNG-6401) Cannot interpolate property in proxy port of settings.xml

    [ https://issues.apache.org/jira/browse/MNG-6401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17585147#comment-17585147 ] 

ASF GitHub Bot commented on MNG-6401:
-------------------------------------

jkatada commented on PR #163:
URL: https://github.com/apache/maven/pull/163#issuecomment-1228044228

   @michael-o
   My understanding of the current status of this PR is as follows
   1. My PR is a regression to string interpolation. This PR should not be merged.
   2. The [`MNG-6401-2`](https://github.com/apache/maven/tree/MNG-6401-2) branch by @hboutemy can resolve this issue while keeping object interpolation.
   
   The `MNG-6401-2` branch can be rebased onto `master` and passed [my new IT](https://github.com/apache/maven-integration-testing/pull/31).
   ```
   [INFO] Tests run: 925, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 396.822 s - in org.apache.maven.it.IntegrationTestSuite
   ```
   
   So I think the `MNG-6401-2` branch should be merged.
   
   Is there anything else I can do to close this PR?
   




> Cannot interpolate property in proxy port of settings.xml
> ---------------------------------------------------------
>
>                 Key: MNG-6401
>                 URL: https://issues.apache.org/jira/browse/MNG-6401
>             Project: Maven
>          Issue Type: Bug
>          Components: Bootstrap &amp; Build, Settings
>    Affects Versions: 3.0, 3.5.3
>            Reporter: KATADA Junya
>            Priority: Minor
>             Fix For: 4.0.x-candidate
>
>
> If you use a property in proxy port of settings.xml, the property is not replaced and the port number is "0" instead of property value.
> My minimal demo about this problem is [here|https://github.com/jkatada/maven-property-demo]. 
> In my demo, export two environment variables as follows.
> {code}
> export MAVEN_PROXY_HOST_STRING=proxy.foo.com
> export MAVEN_PROXY_PORT_INT=18080
> {code}
> These variables are used in settings.xml for proxy settings.
> {code:xml}
> <proxy>
>     <id>my_proxy</id>
>     <active>true</active>
>     <protocol>http</protocol>
>     <host>${env.MAVEN_PROXY_HOST_STRING}</host>
>     <port>${env.MAVEN_PROXY_PORT_INT}</port>
>     <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
>  </proxy>
> {code}
> Execute maven-help-plugin to show effective settings.xml.
> {code}
> mvn help:effective-settings -X
> {code}
> The result is as follows.
> {code:xml}
> <proxy>
>     <port>0</port>
>     <host>proxy.foo.com</host>
>     <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
>     <id>my_proxy</id>
> </proxy>
>  {code}
> `*${env.MAVEN_PROXY_HOST_STRING}*` is replaced with `*proxy.foo.com*`, 
>  but `*${env.MAVEN_PROXY_PORT_INT}*` is not replaced with `*18080*`.
> I found the following WARNING message in console.
> {code:java}
> [WARNING] Some problems were encountered while building the effective settings
> [WARNING] Unable to parse element 'port', must be an integer (position: END_TAG seen ...<port>${env.MAVEN_PROXY_PORT_INT}</port>... @12:47) caused by: java.lang.NumberFormatException: For input string: "${env.MAVEN_PROXY_PORT_INT}" @ /root/.m2/settings.xml, line 12, column 47
> {code}
> I think that the cause of this problem is to parse settings.xml before interpolation.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)