Problem

In Maven when using a aem-api (version 6.0.0.1 at the moment of writing) dependency with some never API dependencies (i.e Sling Models) I run into strange errors like 

Solution

Dependency order matters here. Since aem-api is not a dependency with provided transient dependencies, but a simple collection of .jar files, make sure it is always coming AFTER the never API dependencies.  

<dependencies>
	<dependency>
		<groupId>org.apache.sling</groupId>
		<artifactId>org.apache.sling.models.api</artifactId>
		<version>1.1.0</version>
		<scope>provided</scope>
	</dependency>
	.
	.
	.
	<dependency>
    	<groupid>com.adobe.aem</groupid>
    	<artifactid>aem-api</artifactid>
    	<version>6.0.0.1</version>
    	<scope>provided</scope>
	</dependency>
</dependencies>

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Related issues