Reputation: 390
I'm trying to get started with HttpUnit. I made an Eclipse project with a simple example, but there seems to be a neverending stream of unresolved dependencies and imports it can't find. So I'm starting over:
I just want to get this tutorial to work: http://www.httpunit.org/doc/tutorial/
My jars folder contains:
activation-1.1.jar
js-1.6R5.jar
jtidy-4aug2000r7-dev.jar
junit-3.8.1.jar
mail-1.4.jar
nekohtml-0.9.5.jar
servlet-api-2.4.jar
xercesImpl-2.6.1.jar
xmlParserAPIs-2.6.1.jar
My .classpath file says:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="jars"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Why can't the following imports be resolved?
import com.meterware.httpunit.*;
import com.meterware.servletunit.*;
import junit.framework.*;
Thanks
Upvotes: 1
Views: 348
Reputation: 15769
As one of the httpunit committers I'd recommend to use the maven dependency.
The M2Eclipse plugin will help you to use maven:
as of 2018-09 you can use the version 1.7.3 dependency for httpunit. Then all other depencencies are automatically resolved.
<!-- https://mvnrepository.com/artifact/org.httpunit/httpunit -->
<dependency>
<groupId>org.httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.7.3</version>
<scope>test</scope>
</dependency>
at https://mvnrepository.com/artifact/org.httpunit/httpunit you'lll aways find the latest release.
If you'd like to find out httpunit's own dependencies you can run:
mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< org.httpunit:httpunit >------------------------
[INFO] Building HttpUnit 1.7.4-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ httpunit ---
[INFO] org.httpunit:httpunit:jar:1.7.4-SNAPSHOT
[INFO] +- rhino:js:jar:1.6R5:compile
[INFO] +- junit:junit:jar:4.10:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:compile
[INFO] +- nekohtml:nekohtml:jar:0.9.5:compile
[INFO] +- javax.servlet:servlet-api:jar:2.4:compile
[INFO] +- net.sf.jtidy:jtidy:jar:r938:compile
[INFO] +- xerces:xercesImpl:jar:2.6.1:compile
[INFO] +- xerces:xmlParserAPIs:jar:2.6.1:compile
[INFO] \- javax.mail:mail:jar:1.4:test
[INFO] \- javax.activation:activation:jar:1.1:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.670 s
[INFO] Finished at: 2019-06-15T15:07:46+02:00
[INFO] ------------------------------------------------------------------------
Upvotes: 0
Reputation: 34165
In the Package Explorer or Project Explorer view select all JARs, right-click and choose Build Path > Add to Build Path.
If you did that, the .classpath
file should have an entry like <classpathentry kind="lib" path="... .jar"/>
for each .jar
file.
Upvotes: 0