org.Junit ,Org.junit.runner - cannot be resolved

Issues : 

  • org.Junit - cannot be resolved
  • Org.junit.runner - cannot be resolved

Environment details :
  • JRE 1.8
  • AEM 6.2
  • Eclipse EE Oxyzen 3a
  • Maven Archetype 9/10
Solution : Follow the steps mentioned in the below screenshots:
                 Properties -> Java Build Path -> Libraries -> Add Library -> JUnit -> Junit 3/4



  • Rebuild this tests module project 

  • Check the status of bundle in System/console

javax.inject,version=[0.0,1) — Cannot be resolved


Issue:  javax.inject,version=[0.0,1) — Cannot be resolved

Environment - AEM 6.2, Java 1.8 & Eclipse EE Oxyzen 3a, Archetype 10/9

Solution:

Add the below dependencies to core project POM file:


org.apache.sling 
org.apache.sling.models.api 
1.2.2 provided
 
org.apache.sling 
org.apache.sling.models.impl 
1.2.2 provided
 
org.apache.geronimo.specs 
geronimo-atinject_1.0_spec 
1.0 provided


  • Rebuild the core project and observe the bundle status in /System/console.




Configuration of AEM Plugin for Eclipse

Statement :
                  How to configure the AEM Plugin for Eclipse Oxyzen 3a


Pre-requiste:
  • AEM Author instance is up and runnig(on port 8080)
  • Eclipse Java EE IDE- Oxyzen 3a(used for this article) up and running.
  • JRE 1.8

Install AEM Plugin for Eclipse

  • To install latest AEM Plugin follow the below steps


  • Search for AEM in search files
  • Click on install to complete the installation AEM Developer tools


  • Steps to Open the AEM perspective before we start creating AEM sample project





  •  Create AEMSample Project through AEM Sample Multi-module project as shown in below screenshots:







  •  If Archetype 13 doesn't work select the archetype 9 or 10




    • Error shows Site name is not specified- to resolve the enter the site name under advanced drop down option as shown in screenshot.




    • Steps to create the AEM server in Eclipse for Publish the Sample project to AEM author instance: Change the port number to 8080 and Specify the Server name to any name as shown in below screenshots.





    •  Click on Finish - Observe the Sample project in Project explorer.



    • How to start the AEM server in Eclipse for the Package Sync/Publish to AEM author server.


    •  How to add/remove poject to AEM server- follow the below steps as shown





    • Post finish , AEM server shows publishing is in progress

    • Post Publishing is done, shows the Synchronization has been completed 



    Now it is time to verify the sample project Bundle deployed to AEM Server or not.



    • Observe the OSGI Bundle for the AEMSample project in /System/console
    • Shows Bundle are not installed, Observed below two issue.
     Issue 1


     Solution:

    •  add below dependency to POM file of core project as shown below and issue will get fix!.
                             
      org.apache.sling 
      org.apache.sling.models.api 
    1.2.2 provided

    org.apache.sling 
    org.apache.sling.models.impl 
    1.2.2 provided

    org.apache.geronimo.specs 
    geronimo-atinject_1.0_spec 
    1.0 provided





    • Build the core project once again, follow the below steps shown in below screenshot.
    • Refresh the /System/console to check the status of sampleproject bundle to active state as shown below




    Issue No-2
    1. the-import-org-junit-cannot-be-resolved as shown in below screenshots



    Solution: Perform  the below steps to resolve this
    Properties -> Java Build Path -> Libraries -> Add Library -> JUnit -> Junit 3/4





    • Rebuild the tests project module

    • Restart the AEM server from Eclipse console
    • Check the Sample Project Tests Bundle status in System/console as shown below




    • Also Verify the Status of sample project structure through crx/de light console



    Resolving Invalid Project Definition


    To resolve all projects invalid dependencies 
      • Select all created projects.
      • Right-click. In menu Maven select Update Projects.
      • Check Force Updates of Snapshot/Releases.
      • Click OK. Eclipse tries to download the required dependencies.

      1. URL to download the AEM developer tools and Eclise EE IDE.
      2. AEM Developer tools: https://eclipse.adobe.com/aem/dev-tools/
      3. Eclipse EE IDE : http://www.eclipse.org/downloads/packages/