AEM Project Compilation Issue | Community
Skip to main content
Level 2
September 18, 2023
Solved

AEM Project Compilation Issue

  • September 18, 2023
  • 6 replies
  • 4261 views

The problem you're facing during the compilation of your AEM (Adobe Experience Manager) project is related to the "mvn clean install -PautoInstallSinglePackage" command. When executing this command, you're encountering an error in the "target" folder within "generated-sources/htl". It appears that the build process is unable to delete these files during compilation.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on project aem-projectexample-project.ui.apps: Failed to clean project: Failed to delete C:\Users\user\aem-sdk-projectexample\project\project\ui.apps\target\generated-sources\htl\org\apache\sling\scripting\sightly\apps\projectexample\components\xfpage -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :aem-projectexample-project.ui.apps

Best answer by Sudheer_Sundalam

@johnhenao10 ,

Please try deleting the target folder from ui.apps module manually and try the build again. Some times the clean commands doesn't execute as expected. Maybe due to file type or folder permissions.

6 replies

Sudheer_Sundalam
Community Advisor
Sudheer_SundalamCommunity AdvisorAccepted solution
Community Advisor
September 18, 2023

@johnhenao10 ,

Please try deleting the target folder from ui.apps module manually and try the build again. Some times the clean commands doesn't execute as expected. Maybe due to file type or folder permissions.

Harwinder-singh
Community Advisor
Community Advisor
September 18, 2023

@johnhenao10 Most likely there is another process holding a lock on this folder. Most of the times (at least for me) the culprit is the IDE (eclipse, intelliJ).

Try closing the IDE and then run the build.

santhosh_kumark
Level 6
September 18, 2023

Hi @johnhenao10 

Try mvn clean alone or deleting the file by following the folder structure and run mvn clean install.

aanchal-sikka
Community Advisor
Community Advisor
September 19, 2023

Hello @johnhenao10 

 

1. Please assure target folder is not accessed in any command line or other tool

2. Restart IDE

3. Sometimes, we might still not be able to resolve. So, restart system

Aanchal Sikka
Jagadeesh_Prakash
Community Advisor
Community Advisor
September 19, 2023

@johnhenao10  All the suggestions provided by Advisors are correct. Basically this happens when the mvn is unable to delete the target folder while you run the mvn command. 

 

Below are the solutions

1. If you run the "cmd" with admin privelages

2.if you can run mvn clean before you run mvn install that also helps. 

3. If another program is using the target folder please close it and rerun it once again. 

PGURUKRISHNA
Level 4
August 18, 2025

Hi @johnhenao10 

 

Please close VS Code completely and then run the following command directly in your local terminal:

 

 
mvn clean install -DskipTests -PautoInstallPackage -U \ "-Daem.host=localhost" \ "-Daem.port=4502" \ "-Dsling.username=admin" \ "-Dsling.password=admin" \ "-DAUTHOR_IP=localhost"
 

This issue occurs because VS Code sometimes blocks certain processes required for the build. Running the command in the terminal after closing VS Code ensures the installation works without errors.

Thanks!

Guru Krishna.