Maven error: package does not exist
I can create my java project on my local machine, it works successfully using maven. However, when I build it on Jenkins machine, I get a compilation error:
javax.jms package does not exist
What does it mean? Where is he looking for javax.jms ? In the local m2 repo, classpath?
I had to make the following changes to my pom.xml to get it working on Linux:
a) Explicitly declared version of maven-site-plugin prior to 2.1. org.apache.maven.plugins maven-site-plugin 2.1
b) Changed version of maven-surefire-plugin from 2.4.3 to 2.18.1 Maven-surefire-plugin 2.18.1
c) Added the following dependencies:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.xx.yyy</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.xx.yyy</groupId>
<artifactId>orm</artifactId>
<version>3.1.0.5</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>
Why do I need to change pom.xml on Linux. The build works on my windows 7 machine without changing the pom.xml.
source to share
First try to check if you have the correct dependency for Maven to get packages javax.jms
. You can try Apache Geronimo
addiction or JavaEE API
. (Ref: What's the correct Maven dependency for javax.jms. * Classes? )
For Apache Geronimo
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
</dependency>
For JavaEE API
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
Also, make sure you are building your application for the Jenkins
following purposes:
mvn clean install
After building your application using Maven
on the machine, the Jenkins
package should appear in local m2 repo
to Jenkins
.
source to share