April 24, 2020
Estimated Post Reading Time ~

Convert an AEM Maven project to an Eclipse-based project

In the previous session, we created an AEM project based on an archetype. We explored the project, deployed it into the Felix console, and then accessed the service is exposed. In this session, we will convert the project into an Eclipse project. So that we can import the project into Eclipse. And, later use Eclipse as an IDE for further learning.



Convert the project into an Eclipse project
We can use a Maven command to do this.
Navigate to the project directory.
Execute the following command:

mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true

The project is converted into a Maven project.

Import project into Eclipse and create a Run configuration

  • In Eclipse, select Import > Existing Project Into Workspace.
  • Navigate to the project directory and select Finish.
  • Bundle and Content projects get imported into the current workspace.
  • Update the POM files of respective projects, so the bundle and content are created in the aem-company project (that we have been working with.)
  • In the bundles’s POM, update the Sling URL property as follows:<slingUrl>http://${crx.host}:${crx.port}/apps/aem-company/install</slingUrl>
  • In the Content POM, change the target configuration from myproject to aem-company:

<embeddeds>
    <embedded>
      <groupId>${project.groupId}</groupId>
         <artifactId>myproject-bundle</artifactId>
        <target>/apps/aem-company/install</target>
    </embedded>
 </embeddeds>

  • Create a Run profile.
  • Select Run > Run Configuration.
  • Under Maven Build, right-click > New.
  • Name it as AEM.
  • Update Base Directory to your project’s base directory.
  • Add the following:
Goal: Install
Profile: AutoInstallBundle
Save the configuration.
  • Using CRXDE Lite, navigate to apps/aem-company.
  • Create a folder named install.
  • Now run the configuration.
The project is successfully compiled and deployed into Felix console. You can go to CRXDE Lite and check the Install folder that we created now to see the bundle.
(If you didn’t get it correctly, download the project from my GitHub account.)


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.