Pet*_*ans 7 activation profiles cucumber maven
我在父pom.xmlSpring支持中激活使用
<activation>
<file>
<exists>src/main/resources/*beans.xml</exists>
</file>
</activation>
Run Code Online (Sandbox Code Playgroud)
这很好用.
当我尝试使用时激活配置文件中的CucumberJVM内容
<activation>
<file>
<exists>src/test/resources/**/*.feature</exists>
</file>
</activation>
Run Code Online (Sandbox Code Playgroud)
然而,这拒绝工作.所以我猜**在这种情况下会忽略通配符.
这是正常的,是否有解决方法在.feature文件存在时激活此配置文件?
我真的很惊讶*beans.xml有效.
据我所知,文件激活不支持通配符.<file>可以在FileProfileActivator中找到基于计算配置文件激活的源代码.核心逻辑是这样的:
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();
Run Code Online (Sandbox Code Playgroud)
既不处理通配符interpolate(...)也不alignToBaseDirectory(...)处理通配符.
作为一种解决方法,您可以尝试使用gimick <activation><property>,但这需要使用shell脚本调用maven构建.
| 归档时间: |
|
| 查看次数: |
7378 次 |
| 最近记录: |