我有一个这样定义的属性:
<properties> <main.basedir>${project.parent.basedir}</main.basedir> </properties>
由于我将Windows用作操作系统,因此它包含反斜杠。我想将此路径添加到glassfish域作为JVM选项(使用glassfish maven插件)。问题是,asadmin只能使用斜杠作为分隔符,而我的所有反斜杠都不断消失。如何定义内容与斜杠完全相同的属性?
我认为没有非编程方式可以做到这一点。因此,我建议使用带有Maven GMaven插件的普通代码(GMaven通常是将编程代码嵌入到pom中的最简单方法):
<plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <executions> <execution> <id>setproperty</id> <phase>validate</phase> <goals> <goal>execute</goal> </goals> <configuration> <source> pom.properties['main.basedir']=project.parent.basedir.absolutePath.replace('\\','/'); </source> </configuration> </execution> </executions> </plugin>