maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramón Rial <>
Subject Fwd: About profile activation with JSR223
Date Mon, 07 Sep 2015 06:58:37 GMT
I have redesigned the project. It is available at

Instead of resolving properties  the extension resolves expressions with
the help of Maven interpolator, so it is possible use the original names of
properties and it is possible to write complex expressions.
An example (please, keep in mind that the following example was written
considering the simplicity of the same, not its correct syntax, so the XML
presented here is not well formed. For example, instead of the && you must
write &amp;&amp;):

                var mySiteSkip =
                var reportsEnabled =
                var reportsLevel = aitor.eval('${REPORTS_LEVEL}').getInt(0);
                var siteUrl = aitor.eval('${SITE_URL}').getString('');
                var siteDefined = ( siteUrl != '' );
                mySiteSkip && reportsEnabled && ( reportsLevel > 0 ) &&

 message ----------
From: Ramón Rial <>
Date: 2015-08-25 19:57 GMT+02:00
Subject: About profile activation with JSR223


*About JSR223 support for activating Profiles*
I have a modified version of ** that allows
activate a profile evaluating a script.
I've done that with JSR223, and it is a minimal modification.
The idea is:

   - Keep the old funcionality for property profile activation.
   - Allow the evaluation of scripts in some of the JSR223 languages
   - Add to the context of the evaluation the *ProjectProperties*, the
   *UserProperties* and *SystemProperties*.

*An example of this:*





            <value>( projectProperty == 'value' &amp;&amp; systemProperty
== '45' )

|| ( userProperty == 'development' )</value>




The explanation

The key to get this without modifying the current model of pom and choose
an ScriptEngine is the name of the property.

It begins with "*=*" (equals) char, to indicate that value is a JSR223
script, and after the equals char the name of the script engine.

We write the script in the value tag.

You can see in the example that we use system properties, project
properties and user properties, *AND* and *OR* logical operators, so you
can write so complex scripts as you want.

The logical AND should be written as &amp;&amp; because of XML.

*IMPORTANT*: The new ** converts the name of
the project properties, system properties and user properties to a safe
name, to allow use them in the script, so if you have a project property
with the name "**" it will be replaced in the script
context to "*my_project_property*".


Do you think this could be interesting for Maven 3?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message