Re: How to add test classes into jar?

2008-12-14 Thread Linghua Wang
So specific as Wayne said.  BTW, now in JUnit4, test class don't have to
extends TestCase because of new design based on the JDK5's new
feature(annotation), so test class have a new chance to extends another
class.

Regards.

Linghua

2008/12/14 Wayne Fay wayne...@gmail.com

  You have some test classes that extends something else than TestCase and
 you
  want to share these intermediate classes between projects ?

 Or perhaps he has some utility classes that are used only by his
 tests, or he wants to re-use some test classes for some other reasons.
 There are many good reasons to make the test-jar artifact and share
 test classes amongst multiple projects.

 Wayne

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




Re: How to add test classes into jar?

2008-12-13 Thread Anders Kristian Andersen

Hi

I'm not 100 pct sure I get this right.
You have some test classes that extends something else than TestCase  
and you want to share these intermediate classes between projects ?


If this is the case.
I re comment to re-engineer your test cases so they only extends  
TestCase


/Anders

On 12/12/2008, at 08.43, Linghua Wang wrote:


Hi,

I want to try maven-surefire-plugin. There are two projects A and B, A
depends on B,  and some test classes in A depend on that of in B.  
Both A and

B's POM has the following snippet.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - -

- - - -
  plugin
   groupIdorg.apache.maven.plugins/groupId
   artifactIdmaven-surefire-plugin/artifactId
   configuration
   skipfalse/skip
   /configuration
   /plugin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - -

- - - -

Steps:

1. CD to directory of project B, execute mvn compiler:testCompile  
and mvn

install
2. CD to directory of project A, execute mvn compiler:testComplie,  
maven

always complain that some test classes can not be found in project B.

Question:

Simply, we can resolve it by adding test classes into jar (default
packaging). Somebody could tell me how? Or any other suggestions  
would be

appriciated.

Thanks.
Linghua.



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



Re: How to add test classes into jar?

2008-12-13 Thread Wayne Fay
 You have some test classes that extends something else than TestCase and you
 want to share these intermediate classes between projects ?

Or perhaps he has some utility classes that are used only by his
tests, or he wants to re-use some test classes for some other reasons.
There are many good reasons to make the test-jar artifact and share
test classes amongst multiple projects.

Wayne

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



Re: How to add test classes into jar?

2008-12-12 Thread Wayne Fay
 Simply, we can resolve it by adding test classes into jar (default
 packaging). Somebody could tell me how? Or any other suggestions would be
 appriciated.

You want to create and use a test-jar artifact. This is documented on
the Maven site and in various other places, eg:
http://stackoverflow.com/questions/174560/sharing-test-code-in-maven

Wayne

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



Re: How to add test classes into jar?

2008-12-12 Thread Linghua Wang
Thanks! I found out it based on your comments.  Followings is the details I
have done.

1. Add build snippet into pom.xml of project B. After the execution of
mvn:install, then .../src/main/java/ and /src/test/java were packaged
respectively and installed on my local repository.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
project
...
 build
plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-jar-plugin/artifactId
version2.2/version
executions
execution
goals
goaltest-jar/goal
/goals
/execution
/executions
/plugin
/plugins
/build
...
/project
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -

2. Add this dependency into project A.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
   !--The test myapp-hut--
dependency
groupIdcom.mycompany.hut/groupId
artifactIdmyapp-hut/artifactId
version1.0-SNAPSHOT/version
typetest-jar/type
scopetest/scope
/dependency
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -

3. Then mvn test, things go smoothly.

Thank again.

2008/12/12 Wayne Fay wayne...@gmail.com

  Simply, we can resolve it by adding test classes into jar (default
  packaging). Somebody could tell me how? Or any other suggestions would be
  appriciated.

 You want to create and use a test-jar artifact. This is documented on
 the Maven site and in various other places, eg:
 http://stackoverflow.com/questions/174560/sharing-test-code-in-maven

 Wayne

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




How to add test classes into jar?

2008-12-11 Thread Linghua Wang
Hi,

I want to try maven-surefire-plugin. There are two projects A and B, A
depends on B,  and some test classes in A depend on that of in B. Both A and
B's POM has the following snippet.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
   plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-surefire-plugin/artifactId
configuration
skipfalse/skip
/configuration
/plugin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -

Steps:

1. CD to directory of project B, execute mvn compiler:testCompile and mvn
install
2. CD to directory of project A, execute mvn compiler:testComplie, maven
always complain that some test classes can not be found in project B.

Question:

Simply, we can resolve it by adding test classes into jar (default
packaging). Somebody could tell me how? Or any other suggestions would be
appriciated.

Thanks.
Linghua.