| Author |
Question about JWebUnit / maven
|
Dave Alvarado
Ranch Hand
Joined: Jul 02, 2008
Posts: 434
|
|
Hi,
I'm using Maven 1.1 with JWebUnit 1.4. I'm new to Maven, but how do I set the classpath for the test:compile goal? I have included the JWebUnit dependency in my project.xml file, like so
<dependency>
<groupId>net.sourceforge.jwebunit</groupId>
<artifactId>jwebunit-htmlunit-plugin</artifactId>
<version>1.4</version>
</dependency>
but when I go to run my maven unit test, I get the below compilation errors, all related to jwebunit (or lack thereof). I can see the JAR files that are downloaded. How do I tell maven about them? - Dave
maven -Dtestcase=test.AddToMailingListTest test:single
__ __
| \/ |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
|_| |_\__,_|\_/\___|_||_| v. 1.1
build:start:
test:single:
java:prepare-filesystem:
java:init:
java:compile:
[echo] Compiling to /Users/dalvarado/source/assistanceUtility/webapp/target/classes
[echo]
==========================================================
WARNING: maven.compile.target is not set:
using the default value which depends on your JVM
==========================================================
java:jar-resources:
test:prepare-filesystem:
test:test-resources:
test:compile:
[javac] Compiling 1 source file to /Users/dalvarado/source/assistanceUtility/webapp/target/test-classes
[javac] /Users/dalvarado/source/assistanceUtility/webapp/src/test/java/AddToMailingListTest.java:9: package net.sourceforge.jwebunit.junit does not exist
[javac] import net.sourceforge.jwebunit.junit.WebTestCase;
[javac] ^
[javac] /Users/dalvarado/source/assistanceUtility/webapp/src/test/java/AddToMailingListTest.java:11: cannot find symbol
[javac] symbol: class WebTestCase
[javac] public class AddToMailingListTest extends WebTestCase {
[javac] ^
[javac] /Users/dalvarado/source/assistanceUtility/webapp/src/test/java/AddToMailingListTest.java:28: cannot find symbol
[javac] symbol : variable super
[javac] location: class test.AddToMailingListTest
[javac] super.setUp();
[javac] ^
[javac] /Users/dalvarado/source/assistanceUtility/webapp/src/test/java/AddToMailingListTest.java:30: cannot find symbol
[javac] symbol : method getTestContext()
[javac] location: class test.AddToMailingListTest
[javac] getTestContext().setBaseUrl("http://localhost:8080/apps/oit/governor/citizen/assistanceUtility");
[javac] ^
|
 |
Jeff Storey
Ranch Hand
Joined: Apr 07, 2007
Posts: 230
|
|
The dependency tag can take a "scope" child tag where you can specify it is needed for test. http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html is a link for maven dependency scopes, but yours would look like this:
|
Jeff Storey
Software Developer
[url]http://jeffastorey.blogspot.com[/url]
|
 |
Dave Alvarado
Ranch Hand
Joined: Jul 02, 2008
Posts: 434
|
|
THanks for your reply but maybe the version of Maven I'm using (1.1) doesn't support scope. Below is the error I got. Do you know a way to set the classpath maven uses?
__ __
| \/ |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \ ~ intelligent projects ~
|_| |_\__,_|\_/\___|_||_| v. 1.1
-------------------------------------------------------------------------------
>> Error parsing project.xml '/Users/dalvarado/source/assistanceUtility/webapp/project.xml'
>> ParseError at [row,col]:[231,13]
Message: Unrecognised tag: 'scope'
-------------------------------------------------------------------------------
BUILD FAILED
-------------------------------------------------------------------------------
Total time : 1 seconds
Finished at : Monday, October 5, 2009 7:22:54 AM MDT
Final Memory : 1M/2M
-------------------------------------------------------------------------------
|
 |
Jeff Storey
Ranch Hand
Joined: Apr 07, 2007
Posts: 230
|
|
|
Ah sorry. I actually started using maven with version 2, so I'm not too sure on this one.
|
 |
 |
|
|
subject: Question about JWebUnit / maven
|
|
|