Expand my Community achievements bar.

SOLVED

Error while building the code

Avatar

Level 4

Hi Team,

I have included the below dependency to my core/pom.xml, ui.apps/pom.xml, all/pom.xml in the dependency section. 

<!-- Core WCM Components -->
<dependency>
<groupId>com.adobe.cq</groupId>
<artifactId>core.wcm.components.parent</artifactId>
<version>2.21.0</version>
<type>pom</type>
</dependency>

After maven build it gave the below. 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project we-retail.ui.apps: Compilation failure
[ERROR] /C:/Users/Seema/Documents/Code-Base/we-retail/ui.apps/target/generated-sources/htl/org/apache/sling/scripting/sightly/apps/infra__002d__core/components/title/title_html.java:[40,82] package com.adobe.cq.wcm.core.components.models does not exist.

Can someone help me to resolve this error. 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @skumari1,

It seems you missed core.wcm.components.all, Please try below steps 

1) Edit pom.xml and add the following dependencies in the <dependencies> section:

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

2) Edit core/pom.xml. Add the core.wcm.components.core dependency to the dependency list. Notice that it is not necessary to specify a version, as the version is managed at the Parent pom. It is a best practice to always manage dependency versions within the Parent pom.

//core/pom.xml
 
<dependencies>
...
 
<dependency>
    <groupId>com.adobe.cq</groupId>
    <artifactId>core.wcm.components.core</artifactId>
</dependency>
...
</dependencies>

3) Edit ui.apps/pom.xml. Add the core.wcm.components.all zip as a dependency in the dependency list.

//ui.apps/pom.xml
 
<dependencies>
...
 
<dependency>
   <groupId>com.adobe.cq</groupId>
    <artifactId>core.wcm.components.all</artifactId>
    <type>zip</type>
</dependency>
...
</dependencies>

4) Edit ui.apps/pom.xml. Include core.wcm.components.all zip as a sub-package. This will deploy the Core Components package along with your custom code each time. Beneath the embedded tag add a new tag for subPackages and specify the core.wcm.components.all artifactId.

//ui.apps/pom.xml
<plugins>
...
 
<plugin>
    <groupId>com.day.jcr.vault</groupId>
    <artifactId>content-package-maven-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <group>aem-guides/wknd</group>
        <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
        <properties>
              <acHandling>merge_preserve</acHandling>
        </properties>
        <embeddeds>
            <embedded>
                <groupId>com.adobe.aem.guides</groupId>
                <artifactId>wknd-sites-guide.core</artifactId>
                <target>/apps/wknd/install</target>
            </embedded>
            </embeddeds>
 
            <subPackages>
                <subPackage>
                    <groupId>com.adobe.cq</groupId>
                <artifactId>core.wcm.components.all</artifactId>
                    <filter>true</filter>
                </subPackage>
            </subPackages>
    <targetURL>http://${crx.host}:${crx.port}/crx/packmgr/service.jsp</targetURL>
    </configuration>
</plugin>
...
</plugins>

5) To verify that it works, go to the Package Manager. You should see listed three new items:

  • core.wcm.components.content-2.21.0.zip
  • core.wcm.components.config-2.21.0.zip
  • core.wcm.components.all-2.21.0.zip

Hope that helps!

Regards,

Santosh

View solution in original post

9 Replies

Avatar

Community Advisor

Hi @skumari1 , checking - have you included or tried below dependency in your core pom?

 

<dependency>
				<groupId>com.adobe.cq</groupId>
				<artifactId>core.wcm.components.core</artifactId>
				<version>2.21.0</version>
			</dependency>

In my case aem sdk I have not used 'core.wcm.components.parent'

Avatar

Community Advisor

Hi @skumari1 ,
Could you please post the code snippet of title.html where you are using "com.adobe.cq.wcm.core.components.models" ?

Avatar

Level 4

Hi @BrijeshYadav 

<div class="cmp-title" selenium-id="we-retail-title"
     data-sly-use.title="com.adobe.cq.wcm.core.components.models.Title"
     data-sly-use.template="core/wcm/components/commons/v1/templates.html"
     data-sly-test.text="${title.text}">

Avatar

Correct answer by
Community Advisor

Hi @skumari1,

It seems you missed core.wcm.components.all, Please try below steps 

1) Edit pom.xml and add the following dependencies in the <dependencies> section:

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

2) Edit core/pom.xml. Add the core.wcm.components.core dependency to the dependency list. Notice that it is not necessary to specify a version, as the version is managed at the Parent pom. It is a best practice to always manage dependency versions within the Parent pom.

//core/pom.xml
 
<dependencies>
...
 
<dependency>
    <groupId>com.adobe.cq</groupId>
    <artifactId>core.wcm.components.core</artifactId>
</dependency>
...
</dependencies>

3) Edit ui.apps/pom.xml. Add the core.wcm.components.all zip as a dependency in the dependency list.

//ui.apps/pom.xml
 
<dependencies>
...
 
<dependency>
   <groupId>com.adobe.cq</groupId>
    <artifactId>core.wcm.components.all</artifactId>
    <type>zip</type>
</dependency>
...
</dependencies>

4) Edit ui.apps/pom.xml. Include core.wcm.components.all zip as a sub-package. This will deploy the Core Components package along with your custom code each time. Beneath the embedded tag add a new tag for subPackages and specify the core.wcm.components.all artifactId.

//ui.apps/pom.xml
<plugins>
...
 
<plugin>
    <groupId>com.day.jcr.vault</groupId>
    <artifactId>content-package-maven-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <group>aem-guides/wknd</group>
        <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
        <properties>
              <acHandling>merge_preserve</acHandling>
        </properties>
        <embeddeds>
            <embedded>
                <groupId>com.adobe.aem.guides</groupId>
                <artifactId>wknd-sites-guide.core</artifactId>
                <target>/apps/wknd/install</target>
            </embedded>
            </embeddeds>
 
            <subPackages>
                <subPackage>
                    <groupId>com.adobe.cq</groupId>
                <artifactId>core.wcm.components.all</artifactId>
                    <filter>true</filter>
                </subPackage>
            </subPackages>
    <targetURL>http://${crx.host}:${crx.port}/crx/packmgr/service.jsp</targetURL>
    </configuration>
</plugin>
...
</plugins>

5) To verify that it works, go to the Package Manager. You should see listed three new items:

  • core.wcm.components.content-2.21.0.zip
  • core.wcm.components.config-2.21.0.zip
  • core.wcm.components.all-2.21.0.zip

Hope that helps!

Regards,

Santosh

Avatar

Level 4

Hi @SantoshSai 

Thanks for the detail solution, will try and paste the result here.

Avatar

Level 4

Hi @SantoshSai 

I have modified my pom files same as you have mentioned but still i am getting the same error which saying below:-

ui.apps/target/generated-sources/htl/org/apache/sling/scripting/sightly/apps/infra__002d__core/components/title/title_html.java:[40,82] package com.adobe.cq.wcm.core.components.models does not exist

 

 

Avatar

Level 5

Hi,

 

I got the same error like above -

 

I followed below steps to resolve the issue : 

 

1. Started command prompt terminal with administrator rights and ran the same maven command. It worked as expected and build is success

 

2. To start command prompt with admin rights, right click on cmd and click on run as administrator

 

Hope this helps ! Thanks