You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Hüseyin Kartal (Jira)" <ji...@apache.org> on 2021/12/22 00:55:00 UTC

[jira] [Comment Edited] (MENFORCER-399) requireVariable = requireProperty or requireEnvironmentVariable

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

Hüseyin Kartal edited comment on MENFORCER-399 at 12/22/21, 12:54 AM:
----------------------------------------------------------------------

No, i created a pom for demo.

For explanation. It is possible to use the value of an environment variable or a property in a pom just as follows. It doesn't matter if VAR is an environment variable or a property.
{quote}{{<variable>${VAR}</variable>}}
{quote}
But it's not possible to enforce this behaviour. That ${VAR} is set.

 

To test this with the demo pom, just define environment like:
{quote}export VAR=environment
{quote}
Or pass the property like:
{quote}{{mvn install -DVAR=property}}
{quote}
It is not possible to handle both cases with the enforcer.


was (Author: hsyn):
I created a pom for demo.

You can define an environment variable and/or pass a property to that and the value will be used for the property "variable".  
{quote}{{<variable>${VAR}</variable>}}
{quote}
But it's not possible to enforce this behaviour. That ${VAR} is set.

 

 

To test just define envioronment like:
{quote}export VAR=environment
{quote}
 

Or pass the property like:
{quote}{{mvn install -DVAR=property}}
{quote}
 

> requireVariable = requireProperty or requireEnvironmentVariable
> ---------------------------------------------------------------
>
>                 Key: MENFORCER-399
>                 URL: https://issues.apache.org/jira/browse/MENFORCER-399
>             Project: Maven Enforcer Plugin
>          Issue Type: Improvement
>          Components: Standard Rules
>    Affects Versions: 3.0.0
>            Reporter: Hüseyin Kartal
>            Priority: Major
>         Attachments: pom.xml
>
>
> As far a i know maven doesn't care where a value for ${variable} comes from. In a pom you can access a env.variable or a property by ${variable}.
> Also in some system the value is provided by an environment variable like CICD or by a property maybe a dev environment.
> I would suggest a new standard rule "requireVariable"  which just look like maven for a value for this variable by property or environment.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)