I'm using the properties-maven-plugin to load properties from a file and
trying to use one of these properties in configuring the GWT plugin. GWT has
a "run" goal, which has executePhase=compile. When I invoke gwt:run, the
value of the property in question is null instead of the value from the
file. With an antrun execution bound to compile, I can see that the property
is, indeed, set. Is the gwt:run goal running in some other context than the
antrun goal bound to the compile phase? What's making the property
unavailable?
I'm including below the pom.xml, properties file, and output of running the
gwt:run goal. In the pom, you can see it's configured to 1) read a property
from build.properties, 2) echo the property using antrun, and 3) use the
property in the gwt plugin's configuration. I purposely set the value to
"1${...}" for this example so the null will show very clearly in the output.
In the output, you see that the antrun execution gets the correct value of
"8080", but in the gwt plugin, "1${...}" gets converted to "1null".
Can anyone tell me why it behaves this way?
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>build.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="This should be just before
the gwt:run."/>
<echo message="The tomcat.httpPort property
is now: ${tomcat.httpPort}"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>foo</runTarget>
<port>1${tomcat.httpPort}</port>
</configuration>
</plugin>
</plugins>
</build>
</project>
build.properties:
$ cat build.properties
tomcat.httpPort=8080
output:
$ mvn gwt:run
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Unnamed - foo:bar:war:1.0-SNAPSHOT
[INFO] task-segment: [gwt:run]
[INFO]
------------------------------------------------------------------------
[INFO] Preparing gwt:run
[INFO] [properties:read-project-properties {execution: read-ant-properties}]
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/home/ryan/dev/projects/radar.git/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [antrun:run {execution: test}]
[INFO] Executing tasks
[echo] This should be just before the gwt:run.
[echo] The tomcat.httpPort property is now: 8080
[INFO] Executed tasks
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for:
org.codehaus.mojo:gwt-maven-plugin:1.1
Cause: Not a number: '1null'
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Jan 19 08:33:21 CST 2010
[INFO] Final Memory: 25M/285M
[INFO]
------------------------------------------------------------------------
--
View this message in context:
http://old.nabble.com/Property-loaded-by-plugin-not-available-to-gwt%3Arun-tp27227122p27227122.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]