Expand my Community achievements bar.

Missing class?

Avatar

Level 3

In the "Writing Sling Servlets" video, this is what I see when watching the video:

missing class.PNG

When I attempt to add this class, it doesn't come up in the autocomplete for me:

missing 2.PNG

According to the documentation, this is apparently part of org.apache.sling.api.servlets class.

Inside of the "company" sample project, I don't see the org.apache.sling.api class in the POM.xml, so it makes sense that the sub-class doesn't exist.

I attempted to add the dependency by adding this to the end of my dependencies list inside my company-core pom.xml

<dependency>

  <groupId>org.apache.sling</groupId>

  <artifactId>org.apache.sling.api</artifactId>

  <version>2.2.0</version>

</dependency>

After I did that, and after I rebuilt the project with "mvn clean install", and even after I deleted and imported the projects back in to the Eclipse workspace, I don't have this class.

If I look at company/company-core/.classpath, I don't see "org.apache.sling.api" in there.

How can I add this class so that I can follow along with the video?

1 Reply

Avatar

Level 1

I needed to perform this extra step (from the project root) after the steps you outlined to get the class to show

mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavaDocs=true

After that, I refreshed the project and the class was available.