Expand my Community achievements bar.

SOLVED

mvn clean test failing due to ui.frontend module

Avatar

Level 3

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]

1 Accepted Solution

Avatar

Correct answer by
Level 3

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

View solution in original post

5 Replies

Avatar

Community Advisor

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,t...


Aanchal Sikka

Avatar

Community Advisor

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.

Avatar

Level 3

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.

Avatar

Community Advisor

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.

AsifChowdhury_0-1690885497332.png

 

Avatar

Correct answer by
Level 3

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