Using Maven to build code on both Windows and Unix systems, you might end up with some quirky situations especially related to file path handling.
It is possible to generate altered Maven properties so that for example backslashes are converted to forward slashes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <id>normalize-property</id> <phase>initialize</phase> <goals> <goal>regex-property</goal> </goals> <configuration> <name>normalized.property</name> <value>${property}</value> <regex>\\</regex> <replacement>/</replacement> </configuration> </execution> </executions> </plugin> |
This can be used to alter properties that are not directly controlled by the developer, such as ${project.baseDir}, and then you can use the result as a property itself: ${normalized.property}
No comments:
Post a Comment
With great power comes great responsibility