I activate in a parent pom.xml
Spring support using
<activation>
<file>
<exists>src/main/resources/*beans.xml</exists>
</file>
</activation>
This works fine.
When I try to activate the CucumberJVM stuff in a profile using
<activation>
<file>
<exists>src/test/resources/**/*.feature</exists>
</file>
</activation>
However this refuses to work. So I guess the **
wildcard is ignored in this context.
Is this normal, is there a workaround to get this profile activated when .feature
files are present?
I'm actually surprised that *beans.xml
works.
As far as I can see, wildcards are not supported in file activation. The source code that calculates profile activation based on <file>
can be found in FileProfileActivator. The core logic goes like this:
String path = //<file><exists> ...
RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
interpolator.addValueSource(/* ${basedir} suppert */)
interpolator.addValueSource( new MapBasedValueSource( context.getProjectProperties() ) );
interpolator.addValueSource( new MapBasedValueSource( context.getUserProperties() ) );
interpolator.addValueSource( new MapBasedValueSource( context.getSystemProperties() ) );
path = interpolator.interpolate( path, "" );
path = pathTranslator.alignToBaseDirectory( path, basedir );
File f = new File( path );
if ( !f.isAbsolute() ){
return false;
}
boolean isActive = f.exists();
And neither interpolate(...)
nor alignToBaseDirectory(...)
process wildcards.
As a workaround you can try some gimick with <activation><property>
, but that would require calling the maven build with a shell script.