You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sena Gbeckor-Kove <se...@gmail.com> on 2005/10/03 11:43:38 UTC

Re: [m2] Filtering problems in Beta

Hi Andrius,

Thanks for the example earlier, I have now run into another problem, I
filter a resource which gets copied into a target directory, so far so
simple. Then I need to to filter the contents of that directory. I
have attempted to do this with the following code :

  <build>
	<resources>
		<resource>
			<targetPath>${basedir}/target/etc/templates</targetPath>
			<filtering>true</filtering>
			<directory>${basedir}/src/main/resources/tokens</directory>
			<includes>
				<include>stage</include>
			</includes>
			<excludes>
				<exclude>*.tokens</exclude>
			</excludes>
		</resource>
		<resource>
			<targetPath>${basedir}/target/etc</targetPath>
			<filtering>true</filtering>
			<directory>${basedir}/src/main/resources/templates</directory>
		</resource>
	</resources>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-resources-plugin</artifactId>
			<executions>
				<execution>
					<id>stage_filtering</id>				
					<goals>
						<goal>resources</goal>
					</goals>
					<configuration>
						<filterPropertiesFile>${basedir}/src/main/resources/tokens/stage</filterPropertiesFile>
						<filtering>true</filtering>
					</configuration>
				</execution>
				<execution>
					<id>template_filtering</id>
					<goals>
						<goal>resources</goal>
					</goals>
					<configuration>
						<filterPropertiesFile>${basedir}/target/templates/stage</filterPropertiesFile>
						<filtering>true</filtering>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
  </build>

Unfortunately this brings up the error :

error copying resources.

Any ideas? This is stumping me somewhat.

Thx

On 30/09/05, Andrius Karpavicius <An...@sintagma.lt> wrote:
> Example with filtering.
>
> In resource settings I define target path as well, as I need to filter not
> only src/main/resources but src/main/webapp directories as well.
>
>
>
> <project>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>lt.sintagma.projects</groupId>
>   <artifactId>web-project-skaitis</artifactId>
>   <packaging>war</packaging>
>   <version>3.0</version>
>   <name>SKAITIS CIA Web site project</name>
>   <url>http://www.sintagma.lt</url>
>   <build>
>     <!-- When packaging war file, both "/src/main/resources" and
> "/src/main/webapp"
>           should pass through a resource filter to replace @property@
> properties with a value from a filter file
>      -->
>     <resources>
>       <resource>
>         <targetPath>../filtered-webapp-resources</targetPath>
>         <filtering>true</filtering>
>         <directory>${basedir}/src/main/webapp</directory>
>       </resource>
>       <resource>
>  <targetPath>../filtered-webapp-resources/WEB-INF/classes</targetPath>
>         <filtering>true</filtering>
>         <directory>${basedir}/src/main/resources</directory>
>       </resource>
>     </resources>
>    <plugins>
>
>      <!-- Resources plugin configuration to enable filtering.
>           Files will be copied from <directory> to <targetPath>
> directories
>           as defined in project.build.resources configuration
>           This also requires War plugin configuration modification
>       -->
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-resources-plugin</artifactId>
>        <executions>
>          <execution>
>            <goals>
>              <goal>resources</goal>
>            </goals>
>            <configuration>
>
> <filterPropertiesFile>${basedir}/src/filters/${filterFile}</filterPropertiesFile>
>              <filtering>true</filtering>
>            </configuration>
>           </execution>
>         </executions>
>       </plugin>
>
> ...
>
> Andrius
>
>
>
>
> Sena Gbeckor-Kove <se...@gmail.com>
> 2005.09.30 15:52
> Please respond to
> "Maven Users List" <us...@maven.apache.org>
>
>
> To
> Maven Users List <us...@maven.apache.org>, Brett Porter
> <br...@gmail.com>
> cc
>
> Subject
> Re: [m2] Filtering problems in Beta
>
>
>
>
>
>
> Hi,
>
> I was wondering if anybody could give mea fragment of their pom where
> they are using filtering. I am migratnig a large project at the EPO
> and I can't find any ocumentation on it. I am using beta 2.
>
> Thx
>
>
>
> On 24/09/05, Brett Porter <br...@gmail.com> wrote:
> > FYI - In beta-2, while the other technique is still supported, the
> > recommended way is finally settled:
> >
> > <build>
> >   <filters>
> >     <filtersFile>...</filtersFile>
> >   </filters>
> > </build>
> >
> > (also available in profiles).
> >
> > Sorry it missed beta-1, but we will be retaining the other option for
> > backwards compatibility.
> >
> > - Brett
> >
> > On 9/24/05, Tony Steele <to...@bbc.co.uk> wrote:
> > > Thanks
> > >
> > > That worked, I left out the target path as I wanted it to go to the
> > > default location.
> > >
> > > Tony
> > >
> > > -----Original Message-----
> > > From: Andrius Karpavicius [mailto:Andrius.Karpavicius@sintagma.lt]
> > > Sent: 23 September 2005 13:09
> > > To: Maven Users List
> > > Subject: Re: [m2] Filtering problems in Beta
> > >
> > >
> > > Hi,
> > >
> > > Add <filtering>true</filtering> parameter in resources descriptor
> > >
> > >   <build>
> > >     <resources>
> > >       <resource>
> > >         <targetPath>../filtered-webapp-resources</targetPath>
> > >         <filtering>true</filtering>
> > >         <directory>${basedir}/src/main/webapp</directory>
> > >       </resource>
> > >
> > >     </resources>
> > >
> > > Andrius
> > >
> > >
> > >
> > >
> > > "Tony Steele" <to...@bbc.co.uk>
> > > 2005.09.23 13:01
> > > Please respond to
> > > "Maven Users List" <us...@maven.apache.org>
> > >
> > >
> > > To
> > > <us...@maven.apache.org>
> > > cc
> > >
> > > Subject
> > > [m2] Filtering problems in Beta
> > >
> > >
> > >
> > >
> > >
> > >
> > > When I upgraded to the beta version, the filtering of resources
> > > specified in my pom stopped working.
> > > I found this on jira http://jira.codehaus.org/browse/MNG-788  which
> > > indicated that there had been improvements to resource filtering.
> > >
> > > My filtering uses profiles and is set up as follows:
> > >
> > >                  <build>
> > >                                  <plugins>
> > >                                                  <plugin>
> > >
> > > <groupId>org.apache.maven.plugins</groupId>
> > >
> > > <artifactId>maven-resources-plugin</artifactId>
> > >  <configuration>
> > >   <filtering>true</filtering>
> > >
> > > <filterPropertiesFile>${resource.filter.file}</filterPropertiesFile>
> > >  </configuration>
> > >                                                  </plugin>
> > >                                  </plugins>
> > >                  </build>
> > >
> > >                  <profiles>
> > >                                  <profile>
> > >                                    <id>live</id>
> > >                                    <properties>
> > >
> > >
> <resource.filter.file>${basedir}/conf/${project.artifactId}-live.propert
> > > ies</resource.filter.file>
> > >                                    </properties>
> > >                                  </profile>
> > >                                  <profile>
> > >                                    <id>pcdev</id>
> > >                                    <properties>
> > >
> > >
> <resource.filter.file>${basedir}/conf/${project.artifactId}-pcdev.proper
> > > ties</resource.filter.file>
> > >                                    </properties>
> > >                                  </profile>
> > >                                  <profile>
> > >                                    <id>uat</id>
> > >                                    <properties>
> > >
> > >
> <resource.filter.file>${basedir}/conf/${project.artifactId}-uat.properti
> > > es</resource.filter.file>
> > >                                    </properties>
> > >                                  </profile>
> > >                  </profiles>
> > >
> > > I have tried removing the profiles, and specified the
> > > filterPropertiesFile directly, but is still does not work.
> > >
> > > Any idea what changes could have stopped the above working. Tony
> Steele
> > >
> > >
> > > http://www.bbc.co.uk/
> > >
> > > This e-mail (and any attachments) is confidential and may contain
> > > personal views which are not the views of the BBC unless specifically
> > > stated. If you have received it in error, please delete it from your
> > > system.
> > > Do not use, copy or disclose the information in any way nor act in
> > > reliance on it and notify the sender immediately. Please note that the
> > > BBC monitors e-mails sent or received.
> > > Further communication will signify your consent to this.
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > > http://www.bbc.co.uk/
> > >
> > > This e-mail (and any attachments) is confidential and may contain
> > > personal views which are not the views of the BBC unless specifically
> > > stated.
> > > If you have received it in error, please delete it from your system.
> > > Do not use, copy or disclose the information in any way nor act in
> > > reliance on it and notify the sender immediately. Please note that the
> > > BBC monitors e-mails sent or received.
> > > Further communication will signify your consent to this.
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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
>
>

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


Re: [m2] Filtering problems in Beta

Posted by Kees de Kooter <kd...@gmail.com>.
This works for me (m2b3):

	<build>
		<!-- Filter web resources to perform some replacements -->
		<!-- -->
		<filters>
			<filter>src/filters/internet-server.properties</filter>
		</filters>
		<outputDirectory>target/filtered-webapp-resources</outputDirectory>
		<resources>
			<resource>
				<directory>src/main/webapp</directory>
				<filtering>true</filtering>
			</resource>
		</resources>

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


Re: [m2] Filtering problems in Beta

Posted by Sena Gbeckor-Kove <se...@gmail.com>.
Hi again Andrius,
(or whoever else can help ;)

I thought tha the explanations given above had helped my case, but my
project appears to be suffering from the mysterious 'bit-rot'. My
current situation is as such, M2 is refusing to tokenise my file
called 'stage'. I am trying to copy the file from one location to
another, while filtering in some java system properties, which I have
been led to believe should work.  The file stage is a filters file
which itself needs to be filtered before being used.Here is an extract
of the pom, the filters file folows that :

Thx in advance.


    <build>
	<resources>
		<resource>
			<targetPath>../templates</targetPath>
			<filtering>true</filtering>
			<directory>src/main/resources/tokens</directory>
			<includes>
				<include>stage</include>
			</includes>
		</resource>
		<resource>
			<targetPath>../prepackage/config</targetPath>
			<filtering>true</filtering>
			<directory>src/main/resources/templates</directory>
			<includes>
				<include>config.xml</include>
				<include>log4j.xml</include>
				<include>server-config.wsdd</include>
			</includes>
		</resource>
		<resource>
			<targetPath>../prepackage/etc</targetPath>
			<filtering>false</filtering>
			<directory>target/prepackage/config</directory>
			<includes>
				<include>log4j.xml</include>
			</includes>
		</resource>
		<resource>
			<targetPath>../testpackages</targetPath>
			<filtering>false</filtering>
			<directory>src/test/testpackages</directory>
		</resource>
	</resources>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-resources-plugin</artifactId>
			<executions>
				<execution>
					<id>stage_filtering</id>				
					<goals>
						<goal>resources</goal>
					</goals>
					<configuration>
						<!-- <filterPropertiesFile>src/main/resources/tokens/stage</filterPropertiesFile>-->
						<filtering>true</filtering>
					</configuration>
				</execution>
				<execution>
					<id>template_filtering</id>
					<goals>
						<goal>resources</goal>
					</goals>
					<configuration>
						<filterPropertiesFile>target/templates/stage</filterPropertiesFile>
						<filtering>true</filtering>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
  </build>

Filters file (stage):

#
# DepotGate Stage Descriptor
# Version $Revision$
#

# the level against which is logged
# PROD: INFO
# default: DEBUG
log.level.log4j=DEBUG

# directories
# directory to log to
fs.dir.log=${java.io.tmpdir}depotgate.log

# The Depot root directory (where uploaded files are stored)
# OSA: /jdepot/root
fs.dir.depotbase=${java.io.tmpdir}depot

# The home directory of the JDepot binaries, configuration etc.
# OSA: /work/jdepot
fs.dir.jdepothome=${java.io.tmpdir}depot

# temporary directory in which to store SOAP attachments
# e.g. /tmp
# must have at least 400M of space available
# OSA: /jdepot/attachments
fs.dir.attachments=${java.io.tmpdir}attachments

# temporary directory for saving uploaded files to
# e.g. /tmp
fs.dir.staging=${java.io.tmpdir}

# the FQ DNS hostname by which the system is reachable
# OSA: jdepot-o.internal.epo.org
net.inet.dns.vhost=localhost

# the URL which the web server is accessable via
# e.g. http://jdepot.internal.epo.org/depot
# this does not normally have to be changed
net.inet.url.depotprefix=http://${net.inet.dns.vhost}/depot


On 04/10/05, Andrius Karpavicius <An...@sintagma.lt> wrote:
> Hi,
>
> The way you have defined here, the files will always come from /src
> directory.
>
> Plus
> <filterPropertiesFile>${basedir}/src/main/resources/tokens/stage</filterPropertiesFile>
> should point to a file, not a directory.??
>
> Maybe first you can filter into some temporary directory that filter that
> again. For this you will have to declare resources plugin twice with a
> diferent stage of execution and in it's configuration specify directories
> to filter. A month ago it didn't work to specify a source and target
> directories in a plugin directly, although a model seemed to support it.
> You can try how it works now.
>
>
> Andrius
>
>
>
>
>
> Sena Gbeckor-Kove <se...@gmail.com>
> 2005.10.03 12:43
> Please respond to
> "Maven Users List" <us...@maven.apache.org>
>
>
> To
> Maven Users List <us...@maven.apache.org>
> cc
>
> Subject
> Re: [m2] Filtering problems in Beta
>
>
>
>
>
>
> Hi Andrius,
>
> Thanks for the example earlier, I have now run into another problem, I
> filter a resource which gets copied into a target directory, so far so
> simple. Then I need to to filter the contents of that directory. I
> have attempted to do this with the following code :
>
>   <build>
>                  <resources>
>                                  <resource>
>  <targetPath>${basedir}/target/etc/templates</targetPath>
>  <filtering>true</filtering>
>  <directory>${basedir}/src/main/resources/tokens</directory>
>                                                  <includes>
>  <include>stage</include>
>                                                  </includes>
>                                                  <excludes>
>  <exclude>*.tokens</exclude>
>                                                  </excludes>
>                                  </resource>
>                                  <resource>
>  <targetPath>${basedir}/target/etc</targetPath>
>  <filtering>true</filtering>
>  <directory>${basedir}/src/main/resources/templates</directory>
>                                  </resource>
>                  </resources>
>                  <plugins>
>                                  <plugin>
>  <groupId>org.apache.maven.plugins</groupId>
>  <artifactId>maven-resources-plugin</artifactId>
>                                                  <executions>
>  <execution>
>   <id>stage_filtering</id>
>   <goals>
>                  <goal>resources</goal>
>   </goals>
>   <configuration>
>
> <filterPropertiesFile>${basedir}/src/main/resources/tokens/stage</filterPropertiesFile>
>                  <filtering>true</filtering>
>   </configuration>
>  </execution>
>  <execution>
>   <id>template_filtering</id>
>   <goals>
>                  <goal>resources</goal>
>   </goals>
>   <configuration>
>
> <filterPropertiesFile>${basedir}/target/templates/stage</filterPropertiesFile>
>                  <filtering>true</filtering>
>   </configuration>
>  </execution>
>                                                  </executions>
>                                  </plugin>
>                  </plugins>
>   </build>
>
> Unfortunately this brings up the error :
>
> error copying resources.
>
> Any ideas? This is stumping me somewhat.
>
> Thx
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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] Filtering problems in Beta

Posted by Andrius Karpavicius <An...@sintagma.lt>.
Hi,

The way you have defined here, the files will always come from /src 
directory.

Plus 
<filterPropertiesFile>${basedir}/src/main/resources/tokens/stage</filterPropertiesFile> 
should point to a file, not a directory.??

Maybe first you can filter into some temporary directory that filter that 
again. For this you will have to declare resources plugin twice with a 
diferent stage of execution and in it's configuration specify directories 
to filter. A month ago it didn't work to specify a source and target 
directories in a plugin directly, although a model seemed to support it. 
You can try how it works now.


Andrius





Sena Gbeckor-Kove <se...@gmail.com> 
2005.10.03 12:43
Please respond to
"Maven Users List" <us...@maven.apache.org>


To
Maven Users List <us...@maven.apache.org>
cc

Subject
Re: [m2] Filtering problems in Beta






Hi Andrius,

Thanks for the example earlier, I have now run into another problem, I
filter a resource which gets copied into a target directory, so far so
simple. Then I need to to filter the contents of that directory. I
have attempted to do this with the following code :

  <build>
                 <resources>
                                 <resource>
 <targetPath>${basedir}/target/etc/templates</targetPath>
 <filtering>true</filtering>
 <directory>${basedir}/src/main/resources/tokens</directory>
                                                 <includes>
 <include>stage</include>
                                                 </includes>
                                                 <excludes>
 <exclude>*.tokens</exclude>
                                                 </excludes>
                                 </resource>
                                 <resource>
 <targetPath>${basedir}/target/etc</targetPath>
 <filtering>true</filtering>
 <directory>${basedir}/src/main/resources/templates</directory>
                                 </resource>
                 </resources>
                 <plugins>
                                 <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-resources-plugin</artifactId>
                                                 <executions>
 <execution>
  <id>stage_filtering</id>  
  <goals>
                 <goal>resources</goal>
  </goals>
  <configuration>
  
<filterPropertiesFile>${basedir}/src/main/resources/tokens/stage</filterPropertiesFile>
                 <filtering>true</filtering>
  </configuration>
 </execution>
 <execution>
  <id>template_filtering</id>
  <goals>
                 <goal>resources</goal>
  </goals>
  <configuration>
  
<filterPropertiesFile>${basedir}/target/templates/stage</filterPropertiesFile>
                 <filtering>true</filtering>
  </configuration>
 </execution>
                                                 </executions>
                                 </plugin>
                 </plugins>
  </build>

Unfortunately this brings up the error :

error copying resources.

Any ideas? This is stumping me somewhat.

Thx







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