java:jar-resources vs. test:test-resources

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

java:jar-resources vs. test:test-resources

Jens Zastrow
Why there is the following difference?!

 

java:jar-resources gets called AFTER java:compile.

test:test-resources gets called BEFORE test:compile.

 

i have some test:compile-postgoals with create resources which need to be in the test-classes/ before test:test.

calling the test:test-resources BEFORE the test:compile postgoals does not have the chance to copy these resources.

 

Bug or Feature?!

Jens Zastrow

DAI-Labor - Technische Universit├Ąt Berlin

Sekretariat GOR 1-1, Franklinstra├če 28/29, 10587 Berlin

Fon: +49 30 314 77777

Fax: +49 30 314 21799

[hidden email] <mailto:[hidden email]>

http://www.dai-labor.de

 

Reply | Threaded
Open this post in threaded view
|

Re: java:jar-resources vs. test:test-resources

brettporter
Administrator
Jens Zastrow wrote:

>Why there is the following difference?!
>
>  
>
No idea. They should both be after, IMO.

>
>
>
>i have some test:compile-postgoals with create resources which need to be in the test-classes/ before test:test.
>
>calling the test:test-resources BEFORE the test:compile postgoals does not have the chance to copy these resources.
>
>  
>
Sorry, I don't understand. You have a postGoal on test:compile and it is
not run before test:test?

This is more a question for the users list.

Cheers,
Brett


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: java:jar-resources vs. test:test-resources

Jens Zastrow
In reply to this post by Jens Zastrow
i posted the question here because i think this is a bug in mv1.
test:test should have the prereqs="test:test-resources" not test:compile

the scenario:

<postGoal "test:compile">
        compile some sources to target/ABC
</postgoal>

[project.xml]
<unitTest>
        <resources>
      <resource>
                        <directory>target/ABC</directory>
                        <includes>
                                <include>**/*</include>
                        </includes>
                </resource>
...

with the current behaviour maven tries to copy "target/ABC" BEFORE
test:compile which is useless because there exist no files at this point
of the build. the files get compiled AFTER test:compile - so they never
get copied at all and cannot be used within the junit tests.

- Jens

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: java:jar-resources vs. test:test-resources

brettporter
Administrator
Jens Zastrow wrote:

>i posted the question here because i think this is a bug in mv1.
>test:test should have the prereqs="test:test-resources" not test:compile
>  
>
no, I don't agree.

>       <resource>
> <directory>target/ABC</directory>
> <includes>
> <include>**/*</include>
> </includes>
> </resource>
>  
>
This is not the intended behaviour of resources. What you should be
doing is copying the files you compile in the test:compile postGoal
directly into target/classes/, ie:

<ant:copy todir="${maven.build.dest}">
  <ant:fileset dir="${maven.build.dir}/ABC" />
</ant:copy>

(where maven.build.dest is target/classes and maven.build.dir is target,
but it's a good idea to use the properties instead where possible).

HTH,
Brett

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]