Adobe-Marketing-Cloud / aem-guides-wknd

Steps to create a website with Adobe Experience Manager (AEM)
https://helpx.adobe.com/experience-manager/kt/sites/using/getting-started-wknd-tutorial-develop.html
76 stars 68 forks source link

Unable to deploy the Card Sling Model #23

Closed ehernandez-xk closed 6 years ago

ehernandez-xk commented 6 years ago

Hi, I'm following the Part 6, and unable to deploy the Card Sling Model to instance.

aem-guides-wknd/core$ mvn -PautoInstallPackage -Padobe-public clean install
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building WKND Sites Project - Core 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ aem-guides-wknd.core ---
[INFO] Deleting /Users/ehernandez/workspace/adobe/wknd/aem-guides-wknd/core/target
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ aem-guides-wknd.core ---
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ aem-guides-wknd.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/ehernandez/workspace/adobe/wknd/aem-guides-wknd/core/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ aem-guides-wknd.core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to /Users/ehernandez/workspace/adobe/wknd/aem-guides-wknd/core/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ aem-guides-wknd.core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/ehernandez/workspace/adobe/wknd/aem-guides-wknd/core/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ aem-guides-wknd.core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/ehernandez/workspace/adobe/wknd/aem-guides-wknd/core/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ aem-guides-wknd.core ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.adobe.aem.guides.wknd.core.models.TestHelloWorldModel
-0-0-0-0-0-0-0-0-0-0-
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.371 s - in com.adobe.aem.guides.wknd.core.models.TestHelloWorldModel
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-bundle-plugin:3.3.0:bundle (default-bundle) @ aem-guides-wknd.core ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ aem-guides-wknd.core ---
[INFO] Installing /Users/ehernandez/workspace/adobe/wknd/aem-guides-wknd/core/target/aem-guides-wknd.core-0.0.1-SNAPSHOT.jar to /Users/ehernandez/.m2/repository/com/adobe/aem/guides/aem-guides-wknd.core/0.0.1-SNAPSHOT/aem-guides-wknd.core-0.0.1-SNAPSHOT.jar
[INFO] Installing /Users/ehernandez/workspace/adobe/wknd/aem-guides-wknd/core/pom.xml to /Users/ehernandez/.m2/repository/com/adobe/aem/guides/aem-guides-wknd.core/0.0.1-SNAPSHOT/aem-guides-wknd.core-0.0.1-SNAPSHOT.pom
[INFO] 
[INFO] --- maven-bundle-plugin:3.3.0:install (default-install) @ aem-guides-wknd.core ---
[INFO] Installing com/adobe/aem/guides/aem-guides-wknd.core/0.0.1-SNAPSHOT/aem-guides-wknd.core-0.0.1-SNAPSHOT.jar
[INFO] Writing OBR metadata
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.015 s
[INFO] Finished at: 2018-06-22T08:45:26-06:00
[INFO] Final Memory: 32M/412M
[INFO] ------------------------------------------------------------------------

core/pom.xml ModelsScannerPlugin

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>maven-sling-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>javax.inject;version=0.0.0,*</Import-Package>
                        <Bundle-SymbolicName>com.adobe.aem.guides.wknd-sites-guide</Bundle-SymbolicName>
                        <_plugin>org.apache.sling.bnd.models.ModelsScannerPlugin</_plugin>
                    </instructions>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>org.apache.sling.bnd.models</artifactId>
                        <version>1.0.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
</build>

Card location:

core/src/main/java/com/adobe/aem/guides/wknd/core/components/Card.java
core/src/main/java/com/adobe/aem/guides/wknd/core/components/impl/CardImpl.java

No logs shown in tail -f crx-quickstart/logs/error.log

ehernandez-xk commented 6 years ago

My bad! the correct command is:

mvn -PautoInstallBundle -Padobe-public clean install

zero298 commented 5 years ago

Just in case anybody else comes by this and accidentally makes the same mistake I was, look explicitly at the -P switches you are using. I had been using mvn -PautoInstallPackage clean install for the first 5 chapters and everything had been working just fine. When I ran into issues and saw that this user addressed the issue with the command they had, I thought that the thing I was missing was just the -Padobe-public. That was not the issue.

The issue is that I was using "-PautoInstallPackage" instead of "-PautoInstallBundle"; that's "Package" instead of "Bundle"! As soon as I fixed that, my Card class started loading and was listed in http://localhost:4502/system/console/status-slingmodels.