maven-help-plugin:evaluate with 'project.groupId' expression give back 'org.apache.maven' instead of 'com.myproject' without error code

I would like use maven-help-plugin:3.2.0:evaluate to grab information from my pom project, but the result was not what I expected.

Please read the edit at the end!

I try to use it after checkout an existing git branch.

Usually it works on most project, first time I hasn't got any solution... Search in the web give me about 900 result, so I haven't any idea now. I try it with maven 3.6.2 with AdoptOpenJDK Java 11

mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId

expected myartifact, but got standalone-pom

mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.groupId

expected com.myproject, but got org.apache.maven

mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId

expected 1.0.0-SNAPSHOT, but got 1

Has anyone any idea?

My pom.xml listed bellow, I don't use parent pom in this project.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.myproject</groupId>
    <version>1.0.0-SNAPSHOT</version>
    <artifactId>myartifact</artifactId>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath>
    </properties>

            <!--
    <distributionManagement>
    ... my dmans
    </distributionManagement>
            -->

            <!--
    <repositories>
    ... my repos
    </repositories>
            -->

    <build>
        <plugins>
            
            <!--
            <plugin>
            ... my plugins which not in org.apache.maven
            </plugin>
            -->

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.5</version>
                <configuration>
                    <append>true</append>
                </configuration>
                <executions>
                    <execution>
                        <id>before-unit-test-execution</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${sonar.jacoco.reportPath}</destFile>
                            <propertyName>surefire.jacoco.args</propertyName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M4</version>
                <configuration>
                    <skipTests>${skip.surefire.tests}</skipTests>
                    <groups>unit</groups>
                    <systemProperties>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                    </systemProperties>
                    <argLine>-Xmx2048m -XX:MaxPermSize=256m ${surefire.jacoco.args}</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

EDIT:

The original problem was solved because the branch name was wrong. So the right question is: Why run Maven with this result, and why don't stop with error exit code?

Thanks

Upvotes: 1

Views: 5359

Answers (1)

Sorry guys it was my fault.

The examinated branch was misspelled in the citated project, and I haven't see the whole error log in that environment.

But I dont'know why run maven without error exit code in that case...

Upvotes: 1

Related Questions