[jetty-dev] [jira] (JETTY-1464) Jetty-Maven-plugin Maven Property Substitution Not Working

"Jan Bartel (JIRA)" <[email protected]>
Newsgroups gmane.comp.java.jetty.general
Message-ID <794276395.45157.1330562642896.JavaMail.j2ee-jira@codehaus01.managed.contegix.com>
     [ https://jira.codehaus.org/browse/JETTY-1464?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Bartel resolved JETTY-1464.
-------------------------------

    Resolution: Not A Bug

Ed,

I don't think this is a jetty bug - the handling of the maven properties is entirely down to maven, so I don't think there's anything we can do about this. If you have contradictory information, then please reopen this issue and attach it.

thanks
Jan
                
> Jetty-Maven-plugin Maven Property Substitution Not Working
> ----------------------------------------------------------
>
>                 Key: JETTY-1464
>                 URL: https://jira.codehaus.org/browse/JETTY-1464
>             Project: Jetty
>          Issue Type: Bug
>          Components: Maven
>    Affects Versions: 8.0.4
>         Environment: Windows7, Eclipse Indigo, Maven 3.0.3, M2E 0.12.1.20110112-1712
>            Reporter: Ed Ost
>            Assignee: Jan Bartel
>              Labels: maven
>         Attachments: mavenjavafirst.zip, maven-output.txt, pom.xml
>
>
> Eclipse properties do not seem to substitute for jetty-maven-plugin.  Snippets below detail the problem.
> <properties>
>   <jetty.version>8.0.4.v20111024</jetty.version>
> </properties>
> <plugin>
>   <groupId>org.mortbay.jetty</groupId>
>   <artifactId>jetty-maven-plugin</artifactId>
>   <version>${jetty.version}</version>
> </plugin>
> ...
> <build>
>   <plugins>
> 	...
> 	<plugin>
> 		<groupId>org.mortbay.jetty</groupId>
> 		<artifactId>jetty-maven-plugin</artifactId>
> 		<configuration>
> 			<webAppConfig>
> 				<!-- contextPath does not seem to resolve maven property -->
> 				<!-- contextPath>/${contextPath}</contextPath -->
> 				<contextPath>/mavenjavafirst</contextPath>
> 			</webAppConfig>
> 			<systemProperties>
> 				<!-- does not seem to want to substitute maven properties -->
> 				<systemProperty>
> 					<key>jetty.port</key>
> 					<value>${port}</value>
> 				</systemProperty>
> 				<systemProperty>
> 					<key>container</key>
> 					<value>${container}</value>
> 				</systemProperty>
> 				<systemProperty>
> 					<key>mySystemProperty</key>
> 					<value>mySystemProperty${port}</value>
> 				</systemProperty>
> 				<!-- systemProperty>
> 					<key>com.sun.management.jmxremote</key>
> 					<value></value>
> 				</systemProperty -->
> 			</systemProperties>
> 		</configuration>
> 	</plugin>
> 	...
>   </plugins>
>   ...
> </build>
> I have verified that these properties are indeed being set correctly in the maven pom file using the antrun-maven plugin to echo the results.
> 	<plugin>
> 		<artifactId>maven-antrun-plugin</artifactId>
> 		<executions>
> 			<execution>
> 				<id>echoJettyPackageProperties</id>
> 				<goals>
> 					<goal>run</goal>
> 				</goals>
> 				<phase>package</phase>
> 				<inherited>false</inherited>
> 				<configuration>
> 					<tasks>
> 						<echo>##### PACKAGE PHASE #####</echo>
> 						<echo>##### container: ${container} #####</echo>
> 						<echo>##### port: ${port} #####</echo>
> 						<echo>##### contextPath: ${contextPath} #####</echo>
> 					</tasks>
> 				</configuration>
> 			</execution>
> 		</executions>
> 	</plugin>
> And it runs fine when I hard code the values.  Am I missing something obvious?
> I've include the full eclipse project (mavenjavafirst.zip which is small), the pom for quick review, and a sample output (maven-output.txt)
> I've include the pom for quick review separately as well, which is a bit more complex because it has a few profiles, but it can be run with the command
> mvn -Pwar -Pjetty -Pjetty-server jetty:run-war
> Note that as currently coded it will work on port 8080, but that the port should be getting overridden to port 8072 based on the systemProperty in the jetty-maven-plugin configuration.
> There is plenty of debug output generated by both the pom and the subsequent Spring context so that we can trace the entire lifecycle of the system properties.  I have attached this in the file called maven-output.txt.
> I've created a completely artificial system property called mySystemProperty for analysis purposes.  It should be set to "mySystemProperty${port}".  The antrun debug shows it correctly set: 
>      [echo] ##### PACKAGE PHASE #####
>      [echo] ##### container: jettyContainer #####
>      [echo] ##### port: 8072 #####
>      [echo] ##### contextPath: mavenjavafirst #####
>      [echo] ##### mySystemProperty: ${mySystemProperty} #####
> In the spring context, I dump the system properties and if you search for mySystemProperty you'll see 
> 2011-12-17 11:40:46,490 [main           ] INFO  PropertyList                   - mySystemProperty: mySystemProperty${port}
> You an also see that the jetty.port system property is not set.
> 2011-12-17 11:40:46,492 [main           ] INFO  PropertyList                   - jetty.port: 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.