Look up hostname from Maven
问题 I'm looking for a way to look up hostname and set it as a property in Maven. This does not work in all environments: ... <properties> <hostname>${env.HOSTNAME}</hostname> </properties> ... Any suggestions? 回答1: Use a groovy script to set the project property <plugin> <groupId>org.codehaus.groovy.maven</groupId> <artifactId>gmaven-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>execute</goal> </goals> <configuration> <source> project.properties[