mvn clean test failing due to ui.frontend module | Community
Skip to main content
Level 2
July 31, 2023
Solved

mvn clean test failing due to ui.frontend module

  • July 31, 2023
  • 2 replies
  • 2471 views

hi team,

 

We are having 'mvn clean test' command on our pipeline to run the unit testing code. But with the latest maven archetype since ui.apps have dependency on ui.frontend and ui.apps.structure it is failing. We are unable to move to next step. Any way to resolve this issue.

 

Failed to execute goal on project project-aem.ui.apps: Could not resolve dependencies for project com.project.cms:project-aem.ui.apps:content-package:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.project.cms:project-aem.ui.frontend:zip:0.0.1-SNAPSHOT, com.project.cms:project-aem.ui.apps.structure:zip:0.0.1-SNAPSHOT: Could not find artifact com.project.cms:project-aem.ui.frontend:zip:0.0.1-SNAPSHOT -> [Help 1]

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by testtttt1

Hi @testtttt1 

You are willing to run the unit tests for Java code right?  And for that, you don't need the ui.apps. If so, you can create a profile for the Surefire plugin that will show in the Maven profiles. Then you can run this profile by selecting it. The profile is responsible to run the unit test of Java code.

 


Thanks  @AsifChowdhury , We have made use of below command mvn clean test -pl core instead of mvn clean test to resolve our issue.

2 replies

aanchal-sikka
Community Advisor
Community Advisor
July 31, 2023

hello @testtttt1 

 

This can be resolved using different build profiles. You can either use a exclude/include pattern.

The additional/default dependency settings with custom profiles will help you achieve your requirement

 

 

Please refer to https://stackoverflow.com/questions/166895/different-dependencies-for-different-build-profiles

https://javainfinite.com/maven/maven-creating-profiles/#:~:text=One%20of%20the%20major%20advantage,the%20dependencies%20in%20one%20pom

Aanchal Sikka
AsifChowdhury
Community Advisor
Community Advisor
August 1, 2023

Hi @testtttt1 

You can modify the existing profile including your desired paths, In a profile you can add a section called build. In this section, you can include/exclude paths.

<build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.2</version> <configuration> <includes> <include> com.example.abc.*.java, com.example.abc.*.*.java </include> </includes> </configuration> </plugin> </plugins> </pluginManagement> </build>

In this way, you can run tests for your targeted section. If you want you can also exclude paths.

testtttt1Author
Level 2
August 1, 2023

Hi @asifchowdhury , 

 

May i know how we can skip ui.apps module as part of mvn clean test command ? ui.apps module has ui.front end and ui.apps.structure dependencies so it is failing if it already doesnt have those zip in local repo. Infact it is failing for mvn compile command. So it is working only for mvn clean install command.

AsifChowdhury
Community Advisor
Community Advisor
August 1, 2023

Hi @testtttt1 

You are willing to run the unit tests for Java code right?  And for that, you don't need the ui.apps. If so, you can create a profile for the Surefire plugin that will show in the Maven profiles. Then you can run this profile by selecting it. The profile is responsible to run the unit test of Java code.