You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by aXXa <bo...@passagen.se> on 2006/11/09 07:57:55 UTC

[M2] move resource files

All,

In vain I have tried to configure the maven-resources-plugin to move only
ONE file from the resources directory ([project-root]/src/main/resources),
but I always end up in moving all files and subdirectories or no files at
all.

Can some one please tell me what I'm doing wrong?

Below is my attempt that resulted in ALL files and folders (including the
excluded log4j.properties file) were moved to the WEB-INF directory
<build>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
        
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/</outputDirectory>
        	<resources>
		<includes>
			<include>fenix-servlet.xml</include>
		</includes>
		<excludes>
			<exclude>log4j.properties</exclude>
		</excludes>
        	</resources>
        </configuration>
      </plugin>
</build>
-- 
View this message in context: http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7253317
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: [M2] move resource files

Posted by franz see <fr...@gmail.com>.
Good day, 

Although the problem has been solved already (with the proper solution), I
would just like to add some information about the maven-resources-plugin for
other readers of this thread.

The maven-resources-plugin takes only the encoding parameter from the
configuration of the plugin section. The rest of its parameters are taken
from the build section. Meaning, it should have been:

<project>
  ...
  <build>
    <outputDirectory>...</outputDirectory>
    <resources>...</resources>
    <testResources>...</testResources>
    ...
  </build>
</project>

Cheers,
Franz


Konstantin Polyzois wrote:
> 
> I hade the same problem a week ago :-)
> 
> On 11/9/06, aXXa <bo...@passagen.se> wrote:
>>
>>
>> Konstantin,
>> Brilliant! ....it works excellent when I added the <init-param> tag
>> pointing
>> out where to find the bean definition file in my <servlet> tag.
>>
>> Thanks!
>>
>>
>> Konstantin Polyzois wrote:
>> >
>> > You can configure Spring to find it in WEB-INF/classes instead by using
>> > the
>> > following in your web.xml:
>> >
>> >     <context-param>
>> >         <param-name>contextConfigLocation</param-name>
>> >         <param-value>/WEB-INF/classes/fenix-servlet.xml</param-value>
>> >     </context-param>
>> >
>> >
>> >     <listener>
>> >         <listener-class>
>> > org.springframework.web.context.ContextLoaderListener</listener-class>
>> >     </listener>
>> >
>> > or if it is the DispatcherServlet use:
>> >
>> > <servlet-class>org.springframework.web.servlet.DispatcherServlet
>> > </servlet-class>
>> >         <init-param>
>> >             <param-name>contextConfigLocation</param-name>
>> >             <param-value>/WEB-INF/classes/fenix-servlet.xml
>> </param-value>
>> >         </init-param>
>> >
>> > So keep your file in
>> >
>> > src/main/resources/fenix-servlet.xml
>> >
>> > /Konstantin
>> >
>> >
>> > On 11/9/06, aXXa <bo...@passagen.se> wrote:
>> >>
>> >>
>> >> ...some more info...
>> >> The reason why I want to move the file 'fenix-servlet.xml' (a Spring
>> bean
>> >> definition file) from src/main/resources to WEB-INF:
>> >> When running tests Spring cannot seem to find the 'fenix-servlet.xml'
>> >> file
>> >> when it resides in the WEB-INF folder
>> >> (${project.build.directory}/${project.build.finalName}/WEB-INF does
>> not
>> >> seem
>> >> to be on the classpath?), but the tests work fine when the file reside
>> in
>> >> the resources folder. Tomcat on the other hand does not find the file
>> >> when
>> >> the file reside in the classes folder when running the web app, but
>> wants
>> >> it
>> >> in the WEB-INF folder...
>> >>
>> >>
>> >> aXXa wrote:
>> >> >
>> >> > All,
>> >> >
>> >> > In vain I have tried to configure the maven-resources-plugin to move
>> >> only
>> >> > ONE file from the resources directory
>> >> ([project-root]/src/main/resources),
>> >> > but I always end up in moving all files and subdirectories or no
>> files
>> >> at
>> >> > all.
>> >> >
>> >> > Can some one please tell me what I'm doing wrong?
>> >> >
>> >> > Below is my attempt that resulted in ALL files and folders
>> (including
>> >> the
>> >> > excluded log4j.properties file) were moved to the WEB-INF directory
>> >> > <build>
>> >> >       <plugin>
>> >> >         <artifactId>maven-resources-plugin</artifactId>
>> >> >         <configuration>
>> >> >
>> >> >
>> <outputDirectory>${project.build.directory}/${project.build.finalName
>> >> }/WEB-INF/</outputDirectory>
>> >> >               <resources>
>> >> >               <includes>
>> >> >                       <include>fenix-servlet.xml</include>
>> >> >               </includes>
>> >> >               <excludes>
>> >> >                       <exclude>log4j.properties</exclude>
>> >> >               </excludes>
>> >> >               </resources>
>> >> >         </configuration>
>> >> >       </plugin>
>> >> > </build>
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7254955
>> >> 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
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7256584
>> 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
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7275998
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: [M2] move resource files

Posted by Konstantin Polyzois <po...@gmail.com>.
I hade the same problem a week ago :-)

On 11/9/06, aXXa <bo...@passagen.se> wrote:
>
>
> Konstantin,
> Brilliant! ....it works excellent when I added the <init-param> tag
> pointing
> out where to find the bean definition file in my <servlet> tag.
>
> Thanks!
>
>
> Konstantin Polyzois wrote:
> >
> > You can configure Spring to find it in WEB-INF/classes instead by using
> > the
> > following in your web.xml:
> >
> >     <context-param>
> >         <param-name>contextConfigLocation</param-name>
> >         <param-value>/WEB-INF/classes/fenix-servlet.xml</param-value>
> >     </context-param>
> >
> >
> >     <listener>
> >         <listener-class>
> > org.springframework.web.context.ContextLoaderListener</listener-class>
> >     </listener>
> >
> > or if it is the DispatcherServlet use:
> >
> > <servlet-class>org.springframework.web.servlet.DispatcherServlet
> > </servlet-class>
> >         <init-param>
> >             <param-name>contextConfigLocation</param-name>
> >             <param-value>/WEB-INF/classes/fenix-servlet.xml
> </param-value>
> >         </init-param>
> >
> > So keep your file in
> >
> > src/main/resources/fenix-servlet.xml
> >
> > /Konstantin
> >
> >
> > On 11/9/06, aXXa <bo...@passagen.se> wrote:
> >>
> >>
> >> ...some more info...
> >> The reason why I want to move the file 'fenix-servlet.xml' (a Spring
> bean
> >> definition file) from src/main/resources to WEB-INF:
> >> When running tests Spring cannot seem to find the 'fenix-servlet.xml'
> >> file
> >> when it resides in the WEB-INF folder
> >> (${project.build.directory}/${project.build.finalName}/WEB-INF does not
> >> seem
> >> to be on the classpath?), but the tests work fine when the file reside
> in
> >> the resources folder. Tomcat on the other hand does not find the file
> >> when
> >> the file reside in the classes folder when running the web app, but
> wants
> >> it
> >> in the WEB-INF folder...
> >>
> >>
> >> aXXa wrote:
> >> >
> >> > All,
> >> >
> >> > In vain I have tried to configure the maven-resources-plugin to move
> >> only
> >> > ONE file from the resources directory
> >> ([project-root]/src/main/resources),
> >> > but I always end up in moving all files and subdirectories or no
> files
> >> at
> >> > all.
> >> >
> >> > Can some one please tell me what I'm doing wrong?
> >> >
> >> > Below is my attempt that resulted in ALL files and folders (including
> >> the
> >> > excluded log4j.properties file) were moved to the WEB-INF directory
> >> > <build>
> >> >       <plugin>
> >> >         <artifactId>maven-resources-plugin</artifactId>
> >> >         <configuration>
> >> >
> >> > <outputDirectory>${project.build.directory}/${project.build.finalName
> >> }/WEB-INF/</outputDirectory>
> >> >               <resources>
> >> >               <includes>
> >> >                       <include>fenix-servlet.xml</include>
> >> >               </includes>
> >> >               <excludes>
> >> >                       <exclude>log4j.properties</exclude>
> >> >               </excludes>
> >> >               </resources>
> >> >         </configuration>
> >> >       </plugin>
> >> > </build>
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7254955
> >> 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
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7256584
> 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: [M2] move resource files

Posted by aXXa <bo...@passagen.se>.
Konstantin,
Brilliant! ....it works excellent when I added the <init-param> tag pointing
out where to find the bean definition file in my <servlet> tag.

Thanks!


Konstantin Polyzois wrote:
> 
> You can configure Spring to find it in WEB-INF/classes instead by using
> the
> following in your web.xml:
> 
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>/WEB-INF/classes/fenix-servlet.xml</param-value>
>     </context-param>
> 
> 
>     <listener>
>         <listener-class>
> org.springframework.web.context.ContextLoaderListener</listener-class>
>     </listener>
> 
> or if it is the DispatcherServlet use:
> 
> <servlet-class>org.springframework.web.servlet.DispatcherServlet
> </servlet-class>
>         <init-param>
>             <param-name>contextConfigLocation</param-name>
>             <param-value>/WEB-INF/classes/fenix-servlet.xml</param-value>
>         </init-param>
> 
> So keep your file in
> 
> src/main/resources/fenix-servlet.xml
> 
> /Konstantin
> 
> 
> On 11/9/06, aXXa <bo...@passagen.se> wrote:
>>
>>
>> ...some more info...
>> The reason why I want to move the file 'fenix-servlet.xml' (a Spring bean
>> definition file) from src/main/resources to WEB-INF:
>> When running tests Spring cannot seem to find the 'fenix-servlet.xml'
>> file
>> when it resides in the WEB-INF folder
>> (${project.build.directory}/${project.build.finalName}/WEB-INF does not
>> seem
>> to be on the classpath?), but the tests work fine when the file reside in
>> the resources folder. Tomcat on the other hand does not find the file
>> when
>> the file reside in the classes folder when running the web app, but wants
>> it
>> in the WEB-INF folder...
>>
>>
>> aXXa wrote:
>> >
>> > All,
>> >
>> > In vain I have tried to configure the maven-resources-plugin to move
>> only
>> > ONE file from the resources directory
>> ([project-root]/src/main/resources),
>> > but I always end up in moving all files and subdirectories or no files
>> at
>> > all.
>> >
>> > Can some one please tell me what I'm doing wrong?
>> >
>> > Below is my attempt that resulted in ALL files and folders (including
>> the
>> > excluded log4j.properties file) were moved to the WEB-INF directory
>> > <build>
>> >       <plugin>
>> >         <artifactId>maven-resources-plugin</artifactId>
>> >         <configuration>
>> >
>> > <outputDirectory>${project.build.directory}/${project.build.finalName
>> }/WEB-INF/</outputDirectory>
>> >               <resources>
>> >               <includes>
>> >                       <include>fenix-servlet.xml</include>
>> >               </includes>
>> >               <excludes>
>> >                       <exclude>log4j.properties</exclude>
>> >               </excludes>
>> >               </resources>
>> >         </configuration>
>> >       </plugin>
>> > </build>
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7254955
>> 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
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7256584
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: [M2] move resource files

Posted by Konstantin Polyzois <po...@gmail.com>.
You can configure Spring to find it in WEB-INF/classes instead by using the
following in your web.xml:

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/classes/fenix-servlet.xml</param-value>
    </context-param>


    <listener>
        <listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

or if it is the DispatcherServlet use:

<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/classes/fenix-servlet.xml</param-value>
        </init-param>

So keep your file in

src/main/resources/fenix-servlet.xml

/Konstantin


On 11/9/06, aXXa <bo...@passagen.se> wrote:
>
>
> ...some more info...
> The reason why I want to move the file 'fenix-servlet.xml' (a Spring bean
> definition file) from src/main/resources to WEB-INF:
> When running tests Spring cannot seem to find the 'fenix-servlet.xml' file
> when it resides in the WEB-INF folder
> (${project.build.directory}/${project.build.finalName}/WEB-INF does not
> seem
> to be on the classpath?), but the tests work fine when the file reside in
> the resources folder. Tomcat on the other hand does not find the file when
> the file reside in the classes folder when running the web app, but wants
> it
> in the WEB-INF folder...
>
>
> aXXa wrote:
> >
> > All,
> >
> > In vain I have tried to configure the maven-resources-plugin to move
> only
> > ONE file from the resources directory
> ([project-root]/src/main/resources),
> > but I always end up in moving all files and subdirectories or no files
> at
> > all.
> >
> > Can some one please tell me what I'm doing wrong?
> >
> > Below is my attempt that resulted in ALL files and folders (including
> the
> > excluded log4j.properties file) were moved to the WEB-INF directory
> > <build>
> >       <plugin>
> >         <artifactId>maven-resources-plugin</artifactId>
> >         <configuration>
> >
> > <outputDirectory>${project.build.directory}/${project.build.finalName
> }/WEB-INF/</outputDirectory>
> >               <resources>
> >               <includes>
> >                       <include>fenix-servlet.xml</include>
> >               </includes>
> >               <excludes>
> >                       <exclude>log4j.properties</exclude>
> >               </excludes>
> >               </resources>
> >         </configuration>
> >       </plugin>
> > </build>
> >
>
> --
> View this message in context:
> http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7254955
> 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: [M2] move resource files

Posted by aXXa <bo...@passagen.se>.
...some more info...
The reason why I want to move the file 'fenix-servlet.xml' (a Spring bean
definition file) from src/main/resources to WEB-INF:
When running tests Spring cannot seem to find the 'fenix-servlet.xml' file
when it resides in the WEB-INF folder
(${project.build.directory}/${project.build.finalName}/WEB-INF does not seem
to be on the classpath?), but the tests work fine when the file reside in
the resources folder. Tomcat on the other hand does not find the file when
the file reside in the classes folder when running the web app, but wants it
in the WEB-INF folder...


aXXa wrote:
> 
> All,
> 
> In vain I have tried to configure the maven-resources-plugin to move only
> ONE file from the resources directory ([project-root]/src/main/resources),
> but I always end up in moving all files and subdirectories or no files at
> all.
> 
> Can some one please tell me what I'm doing wrong?
> 
> Below is my attempt that resulted in ALL files and folders (including the
> excluded log4j.properties file) were moved to the WEB-INF directory
> <build>
>       <plugin>
>         <artifactId>maven-resources-plugin</artifactId>
>         <configuration>
>         
> <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/</outputDirectory>
>         	<resources>
> 		<includes>
> 			<include>fenix-servlet.xml</include>
> 		</includes>
> 		<excludes>
> 			<exclude>log4j.properties</exclude>
> 		</excludes>
>         	</resources>
>         </configuration>
>       </plugin>
> </build>
> 

-- 
View this message in context: http://www.nabble.com/-M2--move-resource-files-tf2600050s177.html#a7254955
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