Last updated Mar 27, 2024

Compilation failure - package does not exist

Symptom: "Compilation failure: package does not exist"

Cause: the javac compile command did not have one or more required .jar files specified on the classpath

Solution: add a dependency element in pom.xml for the artifact that contains the missing class

Example: package javax.servlet.http does not exist

Add this element to pom.xml:

1
2
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.3</version>
    <scope>provided</scope>
</dependency>

How do I find the correct artifact name and version? Best practice is to use the same version as the jar file shipped with the version of JIRA, Confluence etc you are building with.
The provided scope element indicates that the jar file doesn't need to be packaged with the plugin since the main application can already provide it.

Rate this page: