maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maciej Kara? (JIRA) <j...@codehaus.org>
Subject [jira] (MEAR-188) Project property cannot be resolved inside <env-entry> element
Date Sun, 15 Jun 2014 14:44:10 GMT

    [ https://jira.codehaus.org/browse/MEAR-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=348058#comment-348058
] 

Maciej Kara? commented on MEAR-188:
-----------------------------------

Thanks for your message. Could you explain why it works for *applicationName* parameter and
not with *envEntry*? Someone on Stackoverflow said that it is due to fact that envEntries
are load through PlexusConfiguration thus the dynamic project properties are not read.

> Project property cannot be resolved inside <env-entry> element
> --------------------------------------------------------------
>
>                 Key: MEAR-188
>                 URL: https://jira.codehaus.org/browse/MEAR-188
>             Project: Maven Ear Plugin
>          Issue Type: Test
>    Affects Versions: 2.9
>            Reporter: Maciej Kara?
>            Priority: Minor
>             Fix For: 2.10
>
>         Attachments: test.zip
>
>
> I have created simple ear project with filters. I want to use different settings for
each environment and those settings should be passed to generated *application.xml* file inside
the *env-entries*. The generation of ear package is done as shown below:
> {code:xml}
>             <plugin>
>                 <artifactId>maven-ear-plugin</artifactId>
>                 <version>2.9</version>
>                 <configuration>
>                     <generateApplicationXml>true</generateApplicationXml>
>                     <version>6</version>
>                     <envEntries>
>                         <env-entry>
>                             <env-entry-name>customProperty</env-entry-name>
>                             <env-entry-type>java.lang.String</env-entry-type>
>                             <env-entry-value>${custom.property}</env-entry-value>
>                         </env-entry>
>                     </envEntries>
>                     <applicationName>${custom.property}</applicationName>
>                 </configuration>
>             </plugin>
> {code}
> To read maven project properties from external properties file I had to use another plugin:
[properties-maven-plugin|http://mojo.codehaus.org/properties-maven-plugin/]. It successfully
reads properties from file and sets them as maven project properties, so I can insert them
in pom.xml file using *${}*. It works for most of the pom.xml elements (i.e. *<applicationName>*),
unfortunately it is not successfully looked up when I place it inside *env-entry* element
where I need it. Below is generated *application.xml*.
> {code:xml}
>     <?xml version="1.0" encoding="UTF-8"?>
>     <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd"
version="6">
>         <application-name>default property</application-name>
>         <display-name>test</display-name>
>         <env-entry>
>             <env-entry-name>customProperty</env-entry-name>
>             <env-entry-type>java.lang.String</env-entry-type>
>             <env-entry-value>${custom.property}</env-entry-value>
>         </env-entry>
>     </application>
> {code}
> If I put project properties inside the <properties></properties> block everything
works fine, but that doesn't allow me to use filters for *application.xml*.
> I'm attaching maven project with all necessary configuration. I have also submitted an
issue at [Stackoverflow|http://stackoverflow.com/questions/23734249/maven-ear-plugin-project-property-lookup-fails],
because I didn't have account here.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Mime
View raw message