You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jakub Liska <li...@gmail.com> on 2010/12/15 11:25:28 UTC

Resources issue when testing

Hey,

I need resource goal of resource plugin to be set up differently for
test phase, than for build phase. When testing I need to exclude stuff
from src/main/resources. It seems it can't be done, testResources goal
is irrelevant for what I need and resource goal can have only one
setting in pom definition, that takes effect in both test and build
phase...

For example, I'd need following settings to look differently (some
excludes) in testing phase :

		<resources>
		  <resource>
		    <directory>${project.basedir}/src/main/java</directory>
		    <includes>
		        <include>**/*.java</include>
		        <include>service.properties</include>
		    </includes>
		  </resource>
		  <resource>
		    <directory>${project.basedir}/src/main/resources</directory>
		    <includes>
		        <include>**/*.xml</include>
		        <include>**/*.properties</include>
		    </includes>
		  </resource>
		</resources>

The ideal behavior would be if I could define "src/main/*" in
<testResources> but it unfortunately can't be done right now


Please help, I'd have to do tons of code modification if I didn't figure it out.

Regards, Jakub

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


Re: Resources issue when testing

Posted by Anders Hammar <an...@hammar.net>.
It seems as you're trying to use Maven the wrong way. Please describe your
initial problem instead of the possibly incorrect solution you're stuck in.
Why would you want to exclude resources from src/main during testing?

Btw, you should move your service.properties property files from the java
folder to the resources folder.

/Anders
On Wed, Dec 15, 2010 at 11:25, Jakub Liska <li...@gmail.com> wrote:

> Hey,
>
> I need resource goal of resource plugin to be set up differently for
> test phase, than for build phase. When testing I need to exclude stuff
> from src/main/resources. It seems it can't be done, testResources goal
> is irrelevant for what I need and resource goal can have only one
> setting in pom definition, that takes effect in both test and build
> phase...
>
> For example, I'd need following settings to look differently (some
> excludes) in testing phase :
>
>                <resources>
>                  <resource>
>                    <directory>${project.basedir}/src/main/java</directory>
>                    <includes>
>                        <include>**/*.java</include>
>                        <include>service.properties</include>
>                    </includes>
>                  </resource>
>                  <resource>
>
>  <directory>${project.basedir}/src/main/resources</directory>
>                    <includes>
>                        <include>**/*.xml</include>
>                        <include>**/*.properties</include>
>                    </includes>
>                  </resource>
>                </resources>
>
> The ideal behavior would be if I could define "src/main/*" in
> <testResources> but it unfortunately can't be done right now
>
>
> Please help, I'd have to do tons of code modification if I didn't figure it
> out.
>
> Regards, Jakub
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Resources issue when testing

Posted by Wayne Fay <wa...@gmail.com>.
> I need resource goal of resource plugin to be set up differently for
> test phase, than for build phase. When testing I need to exclude stuff
> from src/main/resources. It seems it can't be done, testResources goal

Why would you want to do this? In the test phase, the files in
src/test/resources are put on the classpath BEFORE the files in
src/main/resources so there should be no need to exclude anything,
generally.

Perhaps you can tell us more about your project and we can offer other
solutions if necessary.

Wayne

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