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]
Solved! Go to Solution.
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
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.
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.
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.