You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jonathan Chen <jo...@chen.org.nz> on 2007/08/28 10:26:05 UTC

m2 ear plugin and resource filters.

Hi all,

I'm running Maven 2.0.7 and I'm trying to get resource filtering
working with m2's ear plugin. I have a file which I'm trying to get
certain properties replaced on a "mvn package".

 src/main/application/META-INF/geronimo.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <application
        xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2"
    	xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
      <environment
          xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <moduleId>
          <groupId>${pom.groupId}</groupId>
          <artifactId>${pom.artifactId}</artifactId>
          <version>${pom.version}</version>
          <type>ear</type>
        </moduleId>
      </environment>
    </application>

Ideally, the ${pom.*} properties are replaced with the values from
pom.xml; but for some reason, I can't seem to get it working with:

  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>
    
      <name>EAR goal test</name>
    
      <groupId>test</groupId>
      <artifactId>ear-goal</artifactId>
      <version>1.0-SNAPSHOT</version>
      <packaging>ear</packaging>

      <build>
        <resources>
          <resource>
            <filtering>true</filtering>
            <directory>src/main/application/META-INF</directory>
            <includes>
    		  <include>*.xml</include>
            </includes>
          </resource>
        </resources>

        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
    		  <version>5</version>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </project>

Can anyone on the list see what I'm doing wrong? Any help appreciated.

Cheers.
-- 
Jonathan Chen <jo...@chen.org.nz>
----------------------------------------------------------------------
                                Don't worry about avoiding temptation,
                            as you grow older, it starts avoiding you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: m2 ear plugin and resource filters.

Posted by Wayne Fay <wa...@gmail.com>.
1. Try ${project.*} instead.
2. Consider writing a geronimo plugin (or patching the existing
maven-ear-plugin), and contributing it back. It would be helpful for
other people who need to generate these geronimo.xml files. And I
think it would be pretty simple.

Wayne

On 8/28/07, Jonathan Chen <jo...@chen.org.nz> wrote:
> Hi all,
>
> I'm running Maven 2.0.7 and I'm trying to get resource filtering
> working with m2's ear plugin. I have a file which I'm trying to get
> certain properties replaced on a "mvn package".
>
>  src/main/application/META-INF/geronimo.xml:
>    <?xml version="1.0" encoding="UTF-8"?>
>    <application
>        xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2"
>        xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>      <environment
>          xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
>        <moduleId>
>          <groupId>${pom.groupId}</groupId>
>          <artifactId>${pom.artifactId}</artifactId>
>          <version>${pom.version}</version>
>          <type>ear</type>
>        </moduleId>
>      </environment>
>    </application>
>
> Ideally, the ${pom.*} properties are replaced with the values from
> pom.xml; but for some reason, I can't seem to get it working with:
>
>  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>
>
>      <name>EAR goal test</name>
>
>      <groupId>test</groupId>
>      <artifactId>ear-goal</artifactId>
>      <version>1.0-SNAPSHOT</version>
>      <packaging>ear</packaging>
>
>      <build>
>        <resources>
>          <resource>
>            <filtering>true</filtering>
>            <directory>src/main/application/META-INF</directory>
>            <includes>
>                  <include>*.xml</include>
>            </includes>
>          </resource>
>        </resources>
>
>        <plugins>
>          <plugin>
>            <groupId>org.apache.maven.plugins</groupId>
>            <artifactId>maven-ear-plugin</artifactId>
>            <configuration>
>                  <version>5</version>
>            </configuration>
>          </plugin>
>        </plugins>
>      </build>
>    </project>
>
> Can anyone on the list see what I'm doing wrong? Any help appreciated.
>
> Cheers.
> --
> Jonathan Chen <jo...@chen.org.nz>
> ----------------------------------------------------------------------
>                                Don't worry about avoiding temptation,
>                            as you grow older, it starts avoiding you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: m2 ear plugin and resource filters.

Posted by Jonathan Chen <jo...@chen.org.nz>.
On Tue, Aug 28, 2007 at 05:32:25PM +0200, Stephane Nicoll wrote:
> You're hacking the ear's plugin own resource directory with a standard
> resource. This "own resource dir" was a design error in the early
> days.
> 
> Anyway,  you might be able to configure a custom execution of the
> resource plugin with filtering enabled. But move your files out of
> src/main/application first. There's an issue in Jira to automatically
> support filtering for this directory. I guess I'll do that.

Thanks for that. The vote is in.
-- 
Jonathan Chen <jo...@chen.org.nz>
----------------------------------------------------------------------
"The reason why worry kills more people than work is that more people
 worry than work."                                     - Robert Frost

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: m2 ear plugin and resource filters.

Posted by Stephane Nicoll <st...@gmail.com>.
You're hacking the ear's plugin own resource directory with a standard
resource. This "own resource dir" was a design error in the early
days.

Anyway,  you might be able to configure a custom execution of the
resource plugin with filtering enabled. But move your files out of
src/main/application first. There's an issue in Jira to automatically
support filtering for this directory. I guess I'll do that.

Vote/comment if you're interested.

Thanks,
Stéphane

Move your stuff to src/main/resources

On 8/28/07, Jonathan Chen <jo...@chen.org.nz> wrote:
> Hi all,
>
> I'm running Maven 2.0.7 and I'm trying to get resource filtering
> working with m2's ear plugin. I have a file which I'm trying to get
> certain properties replaced on a "mvn package".
>
>  src/main/application/META-INF/geronimo.xml:
>     <?xml version="1.0" encoding="UTF-8"?>
>     <application
>         xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2"
>         xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>       <environment
>           xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
>         <moduleId>
>           <groupId>${pom.groupId}</groupId>
>           <artifactId>${pom.artifactId}</artifactId>
>           <version>${pom.version}</version>
>           <type>ear</type>
>         </moduleId>
>       </environment>
>     </application>
>
> Ideally, the ${pom.*} properties are replaced with the values from
> pom.xml; but for some reason, I can't seem to get it working with:
>
>   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>
>
>       <name>EAR goal test</name>
>
>       <groupId>test</groupId>
>       <artifactId>ear-goal</artifactId>
>       <version>1.0-SNAPSHOT</version>
>       <packaging>ear</packaging>
>
>       <build>
>         <resources>
>           <resource>
>             <filtering>true</filtering>
>             <directory>src/main/application/META-INF</directory>
>             <includes>
>                   <include>*.xml</include>
>             </includes>
>           </resource>
>         </resources>
>
>         <plugins>
>           <plugin>
>             <groupId>org.apache.maven.plugins</groupId>
>             <artifactId>maven-ear-plugin</artifactId>
>             <configuration>
>                   <version>5</version>
>             </configuration>
>           </plugin>
>         </plugins>
>       </build>
>     </project>
>
> Can anyone on the list see what I'm doing wrong? Any help appreciated.
>
> Cheers.
> --
> Jonathan Chen <jo...@chen.org.nz>
> ----------------------------------------------------------------------
>                                 Don't worry about avoiding temptation,
>                             as you grow older, it starts avoiding you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Large Systems Suck: This rule is 100% transitive. If you build one,
you suck" -- S.Yegge

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org