Using Jetty 7 – Failed to resolve artifact. Missing:

April 2, 2010 at 8:54 am (Uncategorized) (, , , , , , , , , , )

While setting up a basic struts2 webapp, by first using the maven-archetype-webapp artifact, and then adding in a struts2-core dependency, with jetty plugin – I came across a problem.

Adding this to my pom.xml caused problems:

<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
</configuration>
</plugin>
</plugins>

I wanted to add jetty as a plugin to easily run my small webapp while developing it. Astute readers will note that the artifact is “jetty-maven-plugin” which denotes Jetty 7. “maven-jetty-plugin” is the standard Jetty 6 plugin.

The following is the log of the error message that Maven spit out:

[ERROR] BUILD ERROR
[INFO] ————————————————————————
[INFO] Failed to resolve artifact.

Missing:
———-
1) org.glassfish.web:jsp-impl:jar:2.2

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.glassfish.web -DartifactId=jsp-impl -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.glassfish.web -DartifactId=jsp-impl -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.mortbay.jetty:jetty-maven-plugin:maven-plugin:8.0.0.M0
2) org.glassfish.web:jsp-impl:jar:2.2

2) org.glassfish.web:el-impl:jar:2.2

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.glassfish.web -DartifactId=el-impl -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.glassfish.web -DartifactId=el-impl -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.mortbay.jetty:jetty-maven-plugin:maven-plugin:8.0.0.M0
2) org.glassfish.web:el-impl:jar:2.2

3) javax.servlet.jsp:jsp-api:jar:2.2

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=javax.servlet.jsp -DartifactId=jsp-api -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=javax.servlet.jsp -DartifactId=jsp-api -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.mortbay.jetty:jetty-maven-plugin:maven-plugin:8.0.0.M0
2) javax.servlet.jsp:jsp-api:jar:2.2

4) javax.el:el-api:jar:2.2

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=javax.el -DartifactId=el-api -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=javax.el -DartifactId=el-api -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.mortbay.jetty:jetty-maven-plugin:maven-plugin:8.0.0.M0
2) javax.el:el-api:jar:2.2

———-
4 required artifacts are missing.

for artifact:
org.mortbay.jetty:jetty-maven-plugin:maven-plugin:8.0.0.M0

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
oss.sonatype.org (http://oss.sonatype.org/content/repositories/jetty-snapshots/)

I tried this exact same build on two machines, and was still presented with the error that Maven would not, or could not automatically download the dependencies needed to run jetty/my struts2 app.

As a quick fix – I switched the plugin artifactId to “maven-jetty-plugin” to denote jetty 6 , and everything worked fine!

Later I came back to the problem and decided to tackle it. I searched and found all the missing jars needed to make the Jetty 7 plugin work. Here, dear reader, they are:

“/path/to/file” = where you downloaded these jars to on your local pc.

(1)
org.glassfish.web:jsp-impl:jar:2.2
http://download.java.net/maven/2/org/glassfish/web/jsp-impl/2.2.2-b03/jsp-impl-2.2.2-b03.jar
The command to run:

mvn install:install-file -DgroupId=org.glassfish.web -DartifactId=jsp-impl -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file

(2)
org.glassfish.web:el-impl:jar:2.2
http://download.java.net/maven/glassfish/org/glassfish/web/el-impl/2.2.0-SNAPSHOT/el-impl-2.2.0-SNAPSHOT.jar
The command to run:

mvn install:install-file -DgroupId=org.glassfish.web -DartifactId=el-impl -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file

(3)
javax.servlet.jsp:jsp-api:jar:2.2
http://download.java.net/maven/2/javax/servlet/jsp/jsp-api/2.2/jsp-api-2.2.jar
The command to run:

mvn install:install-file -DgroupId=javax.servlet.jsp -DartifactId=jsp-api -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file

(4)
javax.el:el-api:jar:2.2
http://download.java.net/maven/2//javax/el/el-api/2.2/el-api-2.2.jar
The command to run:

mvn install:install-file -DgroupId=javax.el -DartifactId=el-api -Dversion=2.2 -Dpackaging=jar -Dfile=/path/to/file

Note that you can walk/step back the links to the jar downloads to find sha1,md5, and src/javadoc jars too.

Permalink 2 Comments