You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Vanja Petreski <vp...@gmail.com> on 2007/10/10 10:06:32 UTC

[SOLUTION] Filtering resources in the EAR artifact

Hello,

I lost couple of hours with this problem, so I am giving the solution (and
would like to hear the better one, if there is a such).

The problem:

We have ear with couple of modules (ejb, war...) and META-INF with standard
and proprietary descriptors (data-sources.xml, orion-application.xml, etc.).
Some of them need to be filtered (for example: data-sources.xml).

In order to `mvn package` on the ear artifact generate desired structure, we
have to put our descriptors in the ${basedir}/src/main/application (not in
${basedir}/src/main/resources).

And that works. But filtering doesn't! If we set filtering on this folder,
in the target we get classes folder with properly filtered resources, but
the ear is not using them. Ear uses your-ear-artifact in the target to be
made of. In the target/your-ear-artifact there is META-INF, but with non
filtered resources.

The quickest (and only one for now, as I know) solution:

We have to tell ear plugin to use ${basedir}/target/classes  as the resource
folder, since there are located properly filtered resources:

<plugin>
   <artifactId>maven-ear-plugin</artifactId>
      <configuration>
         <resourcesDir>target/classes</resourcesDir>
      </configuration>
</plugin>

Ofcourse, we are using now the standard ${basedir}/src/main/resources folder
with filtering turned on.

Regards,
Vanja

Re: [SOLUTION] Filtering resources in the EAR artifact

Posted by mfs <fa...@gmail.com>.
Was a problem on my end with the usage of the properties..Sorry for the noise

mfs wrote:
> 
> I am trying out what you suggested (as i have an exactly similar
> scenario), but still cant get it to work, below is my configuration as in
> my pom.xml..let me know if anything is missed out..
> 
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-ear-plugin</artifactId>
>         <configuration>
>          
> <earSourceDirectory>${basedir}/src/main/resources</earSourceDirectory>
>           <resourcesDir>${outputDirectory}</resourcesDir> [WE HAVE CUSTOM
> OUTPUT LOCATION AND "outputDirectory" IN THIS CASE POINTS TO
> ${defaultoutputdirectory}/${project.artifactId}/target/classes folder) 
>           <version>5</version>
>           <defaultLibBundleDir>lib</defaultLibBundleDir>
>           <modules>
>             <webModule>
>               <groupId>portal.wes</groupId>
>               <artifactId>wes-webui</artifactId>
>               <bundleDir>/</bundleDir>
>             </webModule>
>             <webModule>
>               <groupId>portal.wicket</groupId>
>               <artifactId>wes-wicket</artifactId>
>               <bundleDir>/</bundleDir>
>             </webModule>
>             <webModule>
>               <groupId>portal.crystal</groupId>
>               <artifactId>wes-crystal</artifactId>
>               <bundleDir>/</bundleDir>
>             </webModule>
>             <ejbModule>
>               <groupId>portal.vcert</groupId>
>               <artifactId>portal-ejb</artifactId>
>               <bundleDir>lib</bundleDir>
>             </ejbModule>
>           </modules>
>         </configuration>
>       </plugin>
>     </plugins>
>     <resources>
>       <resource>
>         <directory>src/main/resources</directory>
>         <filtering>true</filtering>
>         <includes>
>           <include>**/META-INF/**</include>
>         </includes>
>       </resource>
>     </resources>
>   </build>
> 
> Thanks in advance,
> 
> Farhan.
> 
> 
> 
> Vanja Petreski wrote:
>> 
>> Hello,
>> 
>> I lost couple of hours with this problem, so I am giving the solution
>> (and
>> would like to hear the better one, if there is a such).
>> 
>> The problem:
>> 
>> We have ear with couple of modules (ejb, war...) and META-INF with
>> standard
>> and proprietary descriptors (data-sources.xml, orion-application.xml,
>> etc.).
>> Some of them need to be filtered (for example: data-sources.xml).
>> 
>> In order to `mvn package` on the ear artifact generate desired structure,
>> we
>> have to put our descriptors in the ${basedir}/src/main/application (not
>> in
>> ${basedir}/src/main/resources).
>> 
>> And that works. But filtering doesn't! If we set filtering on this
>> folder,
>> in the target we get classes folder with properly filtered resources, but
>> the ear is not using them. Ear uses your-ear-artifact in the target to be
>> made of. In the target/your-ear-artifact there is META-INF, but with non
>> filtered resources.
>> 
>> The quickest (and only one for now, as I know) solution:
>> 
>> We have to tell ear plugin to use ${basedir}/target/classes  as the
>> resource
>> folder, since there are located properly filtered resources:
>> 
>> <plugin>
>>    <artifactId>maven-ear-plugin</artifactId>
>>       <configuration>
>>          <resourcesDir>target/classes</resourcesDir>
>>       </configuration>
>> </plugin>
>> 
>> Ofcourse, we are using now the standard ${basedir}/src/main/resources
>> folder
>> with filtering turned on.
>> 
>> Regards,
>> Vanja
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-SOLUTION--Filtering-resources-in-the-EAR-artifact-tp13131334p20192445.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: [SOLUTION] Filtering resources in the EAR artifact

Posted by mfs <fa...@gmail.com>.
I am trying out what you suggested (as i have an exactly similar scenario),
but still cant get it to work, below is my configuration as in my
pom.xml..let me know if anything is missed out..

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
         
<earSourceDirectory>${basedir}/src/main/resources</earSourceDirectory>
          <resourcesDir>${outputDirectory}</resourcesDir> [WE HAVE CUSTOM
OUTPUT LOCATION AND "outputDirectory" IN THIS CASE POINTS TO
${defaultoutputdirectory}/${project.artifactId}/target/classes folder) 
          <version>5</version>
          <defaultLibBundleDir>lib</defaultLibBundleDir>
          <modules>
            <webModule>
              <groupId>portal.wes</groupId>
              <artifactId>wes-webui</artifactId>
              <bundleDir>/</bundleDir>
            </webModule>
            <webModule>
              <groupId>portal.wicket</groupId>
              <artifactId>wes-wicket</artifactId>
              <bundleDir>/</bundleDir>
            </webModule>
            <webModule>
              <groupId>portal.crystal</groupId>
              <artifactId>wes-crystal</artifactId>
              <bundleDir>/</bundleDir>
            </webModule>
            <ejbModule>
              <groupId>portal.vcert</groupId>
              <artifactId>portal-ejb</artifactId>
              <bundleDir>lib</bundleDir>
            </ejbModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/META-INF/**</include>
        </includes>
      </resource>
    </resources>
  </build>

Thanks in advance,

Farhan.



Vanja Petreski wrote:
> 
> Hello,
> 
> I lost couple of hours with this problem, so I am giving the solution (and
> would like to hear the better one, if there is a such).
> 
> The problem:
> 
> We have ear with couple of modules (ejb, war...) and META-INF with
> standard
> and proprietary descriptors (data-sources.xml, orion-application.xml,
> etc.).
> Some of them need to be filtered (for example: data-sources.xml).
> 
> In order to `mvn package` on the ear artifact generate desired structure,
> we
> have to put our descriptors in the ${basedir}/src/main/application (not in
> ${basedir}/src/main/resources).
> 
> And that works. But filtering doesn't! If we set filtering on this folder,
> in the target we get classes folder with properly filtered resources, but
> the ear is not using them. Ear uses your-ear-artifact in the target to be
> made of. In the target/your-ear-artifact there is META-INF, but with non
> filtered resources.
> 
> The quickest (and only one for now, as I know) solution:
> 
> We have to tell ear plugin to use ${basedir}/target/classes  as the
> resource
> folder, since there are located properly filtered resources:
> 
> <plugin>
>    <artifactId>maven-ear-plugin</artifactId>
>       <configuration>
>          <resourcesDir>target/classes</resourcesDir>
>       </configuration>
> </plugin>
> 
> Ofcourse, we are using now the standard ${basedir}/src/main/resources
> folder
> with filtering turned on.
> 
> Regards,
> Vanja
> 
> 

-- 
View this message in context: http://www.nabble.com/-SOLUTION--Filtering-resources-in-the-EAR-artifact-tp13131334p20143151.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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