[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2022-12-10 Thread Konrad Windszus (Jira)


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

Konrad Windszus commented on MNG-6434:
--

Done in https://github.com/eclipse/sisu.plexus/issues/29.

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
> Fix For: 4.0.x-candidate
>
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



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


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2022-12-10 Thread Michael Osipov (Jira)


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

Michael Osipov commented on MNG-6434:
-

Ah OK, then we need to raise this with Stuart as well. Can you open up an issue 
with Sisu Plexus? I consider {{""}} to be a valid value at least for string 
types.

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
> Fix For: 4.0.x-candidate
>
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



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


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2022-12-10 Thread Konrad Windszus (Jira)


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

Konrad Windszus commented on MNG-6434:
--

This requires a fix in Sisu Plexus: 
https://github.com/eclipse/sisu.plexus/blob/27a29dc633e6b03753a3c8d29a033648630c8831/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/AbstractConfigurationConverter.java#L49.
 Currently default values always overwrite empty explicit configuration values.

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



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


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2022-12-10 Thread Michael Osipov (Jira)


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

Michael Osipov commented on MNG-6434:
-

Pure crap: https://github.com/apache/maven-site/pull/354#issuecomment-1345373414

[~kwin], to what extend can we fix this for 3.9 or 4.0?

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



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


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2022-09-11 Thread Konrad Windszus (Jira)


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

Konrad Windszus commented on MNG-6434:
--

I raised https://github.com/codehaus-plexus/plexus-utils/issues/212 to clarify 
the merging behaviour in plexus-utils with regards to blank values.

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



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


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2022-09-11 Thread Konrad Windszus (Jira)


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

Konrad Windszus commented on MNG-6434:
--

The problem is that the {{Xpp3DomBuilder}} trims all values by default 
(https://github.com/codehaus-plexus/plexus-utils/blob/3896620b4fbf031b1b02b4d46b328c5839a231da/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomBuilder.java#L209)
 and {{Sisu.Plexus}} injects the value only if its length is greater than 0 
(https://github.com/eclipse/sisu.plexus/blob/27a29dc633e6b03753a3c8d29a033648630c8831/org.eclipse.sisu.plexus/src/org/codehaus/plexus/component/configurator/converters/AbstractConfigurationConverter.java#L49).
However, using the {{xml:space}} attribute with value {{preserve}} should 
disable the trim logic 
(https://github.com/codehaus-plexus/plexus-utils/blob/3896620b4fbf031b1b02b4d46b328c5839a231da/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomBuilder.java#L195).

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



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


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2018-06-27 Thread Chris Egerton (JIRA)


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

Chris Egerton commented on MNG-6434:


It seems like the behavior for the API here doesn't really align with the 
expectations a user would have when configuring a Maven plugin. A default value 
is what should be used in the event that a parameter is _not_ specified; if the 
user goes out of their way to specify a value, even an empty/null one, why 
would they still want it overridden by the default?

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2018-06-27 Thread Chris Egerton (JIRA)


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

Chris Egerton commented on MNG-6434:


Thanks for your help! However, the issue isn't that whitespace-only values 
can't be specified, it's that empty values can't be specified ("" vs " "). And, 
beneath that, it's that there's no good way at the moment for a user to 
override a default value for a configuration with something that says "I know 
this has a default value but I really don't want it included". We could just 
recommend a value for the configuration and remove the defaults altogether, but 
that would make it harder on our users and be a non-backwards-compatible change 
that we'd like to avoid if possible.

Trying with {{xml:space="preserve"}} and values of " " and "" still resulted in 
the default value being used for the parameter.

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2018-06-27 Thread Karl Heinz Marbaise (JIRA)


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

Karl Heinz Marbaise commented on MNG-6434:
--

I would really hard reconsider my design if a user needs to define an empty 
value as a valid value? Apart from that have you tried to put 
{{xml:space="preserve"}} at your configuration elements..like this:
{code:xml}

   

{code}
And check if you get the space?

https://maven.apache.org/ref/3.5.4/maven-model/maven.html


> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (MNG-6434) Cannot specify empty string for configuration value

2018-06-27 Thread Chris Egerton (JIRA)


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

Chris Egerton commented on MNG-6434:


A workaround we're thinking of is allowing the user to specify "none" as a 
value when they really want it to be null/empty, and then checking for that 
special case during execution. However, this only works for String parameters 
and not for Booleans or Integers.

> Cannot specify empty string for configuration value
> ---
>
> Key: MNG-6434
> URL: https://issues.apache.org/jira/browse/MNG-6434
> Project: Maven
>  Issue Type: Bug
>  Components: Plugin API
>Affects Versions: 3.5.4
>Reporter: Chris Egerton
>Priority: Major
>
> We have a MOJO class that involves several user-configured parameters. Some 
> of these parameters have default values that we'd like to use in the event 
> that the user doesn't specify a value for them; however, we'd also like the 
> user to be able to explicitly specify that the parameter should _not_ have a 
> value. The approach we wanted to take was to specify default values in the 
> parameter's annotation:
> {{@Parameter(property = "foo.bar", defaultValue = "${project.scm.url}")}}
> {{private String foo;}}
> And then detect empty strings as the user's way of saying "I know there's a 
> default value for this parameter but I'm sure that I'd actually like it to be 
> empty anyways.":
> {{}}
> {{  }}
> {{}}
> or
> {{}}
> {{  }}
> {{}}
>  
> However, there's been some trouble as we haven't found a way yet to 
> distinguish between an intentionally-empty string and one that hasn't been 
> specified at all; the value for foo is always null regardless.
> Is there a friendly and/or intuitive way for the user to pass an empty string 
> as a parameter value?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)