Search code examples
mavenosgiaemosgi-bundlesling

How to fix AEM 6.3 - Maven Archetype 12 "No DS descriptor found" errors?


We have created an AEM 6.3 project using Maven Archetype 12. We have not yet written any code and are just trying to build the empty project imported into Eclipse.

We are getting the error which is mentioned in the documentation: https://sling.apache.org/documentation/development/ide-tooling.html#why-do-i-get-an-error-about-no-ds-descriptor-found-at

No DS descriptor found at path target/classes/OSGI-INF/com.xxxxxxx.core.filters.LoggingFilter.xml

The documentation states, "One often-occuring situation is that a Maven project using the maven-scr-plugin generates the descriptors outside of target/classes, typically in target/scr-plugin-generated. To fix this, make sure that you're using the maven-scr-plugin 1.15.0 or newer and that you have not set a custom outputDirectory."

Unfortunately, this does not appear to be the case with our out-of-the-box generated project. The descriptors are not being generated at all. Upgrading maven-scr-plugin to 1.15.0 or even 1.26.0 does not change the symptoms.

What is the proper fix for this issue?

Environment Version Info

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00)
Maven home: C:\usr\apache-maven-3.5.0\bin\..
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_131\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

I can reproduce the error consistently. All steps are captured in this 2-minute video


Solution

  • Adding an empty <Export-Package></Export-Package> worked initially, but then broke when I started writing code. Long-term fix is some combination of the following:

    1. Don't use the newer OSGI @Component annotations, continue to use @SlingServlet instead.

    2. Add this dependency

      <dependency>
          <groupId>org.apache.felix</groupId>
          <artifactId>org.apache.felix.scr.annotations</artifactId>
          <version>1.12.0</version>
      </dependency>
      
    3. Add this plug-in

          <plugin>
              <groupId>org.apache.felix</groupId>
              <artifactId>maven-scr-plugin</artifactId>
              <version>1.26.0</version>
              <executions>
                  <execution>
                      <id>generate-scr-scrdescriptor</id>
                      <phase>compile</phase>
                      <goals>
                          <goal>scr</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>           
      
    4. Not sure if this made a difference, but also upgrade to Sling IDE Tools 1.2.0