You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by devillina <on...@delaware.be> on 2006/07/31 17:16:02 UTC

test-classes in War

Hi, is there a way to include the test classes in the war?
thx
-- 
View this message in context: http://www.nabble.com/test-classes-in-War-tf2028156.html#a5577745
Sent from the Maven - Users forum at Nabble.com.


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


Re: test-classes in War

Posted by devillina <on...@delaware.be>.
I really should get it done in one project, because i work with profiles and
in one profile
i want to include the test-classes in the war and in the other one i just
want to execute them.

thx for the help anyway :)

http://www.nabble.com/user-files/185/pom.xml pom.xml 
-- 
View this message in context: http://www.nabble.com/test-classes-in-War-tf2028156.html#a5613042
Sent from the Maven - Users forum at Nabble.com.


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


Re: test-classes in War

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
devillina wrote:
> I think i'm doing something wrong.
> I put the thing for the jar-plugin in my pom.xml (the one that builds the
> war).
> And i do get a test-jar build.  But building this jar is the last thing
> maven does.
> So when i put the dependency in my war-plugin like this:
> 
> <plugin>
>         <artifactId>maven-war-plugin</artifactId>
>         <configuration>
> 	    <excludes>**/_svn/**</excludes>
> 	    <archive>
> 	        <manifest>
> 		    <addClasspath>true</addClasspath>
> 		</manifest>
> 	    </archive>
>         </configuration>
>         <dependencies>
>             <dependency>
>                  <groupId>be.delaware.jpetstore.samples</groupId>
>                  <artifactId>jpetstore</artifactId>
>                  <version>0.0.1</version>
>                  <type>test-jar</type>
>             </dependency>
>         </dependencies>
> </plugin>
> 
> But he keeps saying he's missing an artifact for the war-plugin (what would
> be logical because he tries to   make the war before the test-jar is even
> build).
> any ideas?

The artifact has to be installed for maven to use it.

in fact - I have these in separate projects. (The tests are build from a 
"server-project" - and I depend on these in a separate "testwar-project").


> (p.s. i can't put my tests in the main source tree, because they want me to
> follow the
> maven default directory structure).
Can you send the complete pom?

My jar-plugin configuration:

		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-jar-plugin</artifactId>
			
			<executions>
			<execution>
				<goals>
					<goal>test-jar</goal>
				</goals>
			</execution>
			</executions>
			
			<configuration>
			  <archive>
			    <index>true</index>

			    <manifestEntries>
				<url>${pom.url}</url>
				<email>${myEmailAddress}</email>
				<buildNumber>${buildNumber}</buildNumber>
			    </manifestEntries>

			    <manifest>
			      <addClasspath>true</addClasspath>
			    </manifest>
			
			  </archive>
			</configuration>
	      </plugin>
	


I think your approach should work as the test-jar will be executed 
before the war-step. The problem is that the artifact is not installed 
in your local repo at this point. If you're totally stuck I would 
recommend splitting it up into two artifacts.





-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

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


Re: test-classes in War

Posted by devillina <on...@delaware.be>.
I think i'm doing something wrong.
I put the thing for the jar-plugin in my pom.xml (the one that builds the
war).
And i do get a test-jar build.  But building this jar is the last thing
maven does.
So when i put the dependency in my war-plugin like this:

<plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
	    <excludes>**/_svn/**</excludes>
	    <archive>
	        <manifest>
		    <addClasspath>true</addClasspath>
		</manifest>
	    </archive>
        </configuration>
        <dependencies>
            <dependency>
                 <groupId>be.delaware.jpetstore.samples</groupId>
                 <artifactId>jpetstore</artifactId>
                 <version>0.0.1</version>
                 <type>test-jar</type>
            </dependency>
        </dependencies>
</plugin>

But he keeps saying he's missing an artifact for the war-plugin (what would
be logical because he tries to   make the war before the test-jar is even
build).
any ideas?

(p.s. i can't put my tests in the main source tree, because they want me to
follow the
maven default directory structure).

thx!
-- 
View this message in context: http://www.nabble.com/test-classes-in-War-tf2028156.html#a5590289
Sent from the Maven - Users forum at Nabble.com.


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


Re: test-classes in War

Posted by "David J. M. Karlsen" <da...@davidkarlsen.com>.
devillina wrote:
> Hi, is there a way to include the test classes in the war?
> thx

See http://maven.apache.org/guides/mini/guide-attached-tests.html.
You can then depend on this artifact in your war.

Or you simply include your tests in the main source tree (and not in the 
test/java directory).

I do the first, and package this in a war which uses JunitEE to run the 
tests and display the results.

David


-- 
David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

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