[ https://issues.apache.org/jira/browse/MNG-6401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
KATADA Junya updated MNG-6401:
------------------------------
Description:
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:bash}
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:bash}
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}
[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.
was:
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.
{quote}export MAVEN_PROXY_HOST_STRING=proxy.foo.com
export MAVEN_PROXY_PORT_INT=18080
{quote}
These variables are used in settings.xml for proxy settings.
{quote}<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>
{quote}
Execute maven-help-plugin to show effective settings.xml.
{quote}mvn help:effective-settings -X
{quote}
The result is as follows.
{quote}<proxy>
<port>0</port>
<host>proxy.foo.com</host>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
<id>my_proxy</id>
</proxy>
{quote}
`${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.
{quote}[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
{quote}
I think that the cause of this problem is to parse settings.xml before interpolation.
> 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 & Build
> Affects Versions: 3.0
> Reporter: KATADA Junya
> Priority: Minor
>
> 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:bash}
> 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:bash}
> 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}
> [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
(v7.6.3#76005)
|