How can I fix this compile error on class com.adobe.cq.wcm.core.components.models.Text ?

jkpanera

02-07-2019

I'm getting a compile error trying to reference the class com.adobe.cq.wcm.core.components.models.Text:

package com.adobe.cq.wcm.core.components.models does not exist

I have this dependency in my pom.xml:

<dependency>
  <groupId>com.adobe.cq</groupId>
  <artifactId>core.wcm.components.all</artifactId>
  <type>zip</type>
  <version>2.2.0</version>
  <scope>provided</scope>
</dependency>

But I don't see it on my maven compile classpath:

[DEBUG] Classpath:

[DEBUG]  /Users/jkramer6/source/aem-www/aem-www/core/target/classes

[DEBUG]  /Users/jkramer6/.m2/repository/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/osgi/org.osgi.compendium/4.2.0/org.osgi.compendium-4.2.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/felix/org.apache.felix.scr.annotations/1.9.8/org.apache.felix.scr.annotations-1.9.8.jar

[DEBUG]  /Users/jkramer6/.m2/repository/biz/aQute/bnd/annotation/2.3.0/annotation-2.3.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/commons/commons-collections4/4.2/commons-collections4-4.2.jar

[DEBUG]  /Users/jkramer6/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar

[DEBUG]  /Users/jkramer6/.m2/repository/commons-codec/commons-codec/1.5/commons-codec-1.5.jar

[DEBUG]  /Users/jkramer6/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/commons/commons-email/1.5/commons-email-1.5.jar

[DEBUG]  /Users/jkramer6/.m2/repository/com/sun/mail/javax.mail/1.5.6/javax.mail-1.5.6.jar

[DEBUG]  /Users/jkramer6/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/osgi/osgi.cmpn/6.0.0/osgi.cmpn-6.0.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar

[DEBUG]  /Users/jkramer6/.m2/repository/javax/jcr/jcr/2.0/jcr-2.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/com/adobe/aem/uber-jar/6.3.1.2/uber-jar-6.3.1.2-apis.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar

[DEBUG]  /Users/jkramer6/.m2/repository/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar

[DEBUG]  /Users/jkramer6/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.7.6/jackson-annotations-2.7.6.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/osgi/org.osgi.service.metatype.annotations/1.3.0/org.osgi.service.metatype.annotations-1.3.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/osgi/org.osgi.service.component.annotations/1.3.0/org.osgi.service.component.annotations-1.3.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/projectlombok/lombok/1.16.16/lombok-1.16.16.jar

[DEBUG]  /Users/jkramer6/.m2/repository/com/google/code/gson/gson/2.3/gson-2.3.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/httpcomponents/httpclient-osgi/4.5.2/httpclient-osgi-4.5.2.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/httpcomponents/httpclient-cache/4.5.2/httpclient-cache-4.5.2.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/httpcomponents/fluent-hc/4.5.2/fluent-hc-4.5.2.jar

[DEBUG]  /Users/jkramer6/.m2/repository/com/adobe/acs/acs-aem-commons-bundle/3.10.0/acs-aem-commons-bundle-3.10.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/poi/poi-ooxml/3.6/poi-ooxml-3.6.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/poi/poi/3.6/poi-3.6.jar

[DEBUG]  /Users/jkramer6/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/poi/poi-ooxml-schemas/3.6/poi-ooxml-schemas-3.6.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/xmlbeans/xmlbeans/2.3.0/xmlbeans-2.3.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/geronimo/specs/geronimo-stax-api_1.0_spec/1.0/geronimo-stax-api_1.0_spec-1.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar

[DEBUG]  /Users/jkramer6/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/sling/org.apache.sling.models.api/1.2.0/org.apache.sling.models.api-1.2.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/com/akamai/edgegrid/edgegrid-signer-apache-http-client/2.1.0/edgegrid-signer-apache-http-client-2.1.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/com/akamai/edgegrid/edgegrid-signer-core/2.1.0/edgegrid-signer-core-2.1.0.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar

[DEBUG]  /Users/jkramer6/.m2/repository/org/apache/commons/commons-configuration2/2.1/commons-configuration2-2.1.jar

[DEBUG]  /Users/jkramer6/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar

[DEBUG] Source roots:

[DEBUG]  /Users/jkramer6/source/aem-www/aem-www/core/src/main/java

Is this because it's a bundle dependency not a jar dependency? If so, where do I find the jar dependency?

Accepted Solutions (1)

Accepted Solutions (1)

Jörg_Hoh

Employee

06-07-2019

You are referencing the zip package of the Core Components. This is the complete package containing both code and the repository structures. If you want to reference parts of the bundle, you need to reference the JAR file.

<dependency>
  <groupId>com.adobe.cq</groupId>
  <artifactId>core.wcm.components.core</artifactId>
  <type>jar</type>
  <version>2.2.0</version>
  <scope>provided</scope>
</dependency>

Answers (5)

Answers (5)

jkpanera

08-07-2019

Thank you. This is the answer I was looking for. This could be explained better in the documentation. Perhaps there should be a page explaining the various dependencies?

Nirmal_Jose

MVP

06-07-2019

can you try forcing your maven to fetch again from the the maven/adobe repo. You can use mvn -F clean install

Else, try create a blank project using latest maven archetype which should download all the dependencies for you.

jkpanera

03-07-2019

Hi thanks for your answer.

I added this to my pom.xml:

<plugins>
  <plugin>
  <groupId>com.day.jcr.vault</groupId>
  <artifactId>content-package-maven-plugin</artifactId>
  <configuration>
  <subPackages>
  <subPackage>
  <groupId>com.adobe.cq</groupId>
  <artifactId>core.wcm.components.all</artifactId>
  <filter>true</filter>
  </subPackage>
  </subPackages>
  </configuration>
  </plugin>

But I'm still getting the same error.

vaibhavs7024655

03-07-2019

jkpanera  In addition to the dependency you have added[1] to your pom, you will also need to add the sub package to your sub package section[2] inside the configuration of content-package-maven-plugin.

Refer GitHub - adobe/aem-core-wcm-components: Adobe Experience Manager (AEM) Sites Core Components - flexi...  for more details.

[1]

<dependency>
  <groupId>com.adobe.cq</groupId>
  <artifactId>core.wcm.components.all</artifactId>
  <type>zip</type>
  <version>2.5.0</version>
</dependency>

[2]

<subPackage>
  <groupId>com.adobe.cq</groupId>
  <artifactId>core.wcm.components.all</artifactId>
  <filter>true</filter>
</subPackage>