Search code examples
mavenpom.xmlglassfish-4java-ee-7maven-install-plugin

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project dukes-store


I want setup duke forest application on glassfish so for that i used the javaee 7 sdk and after that while performing maven install from command line it gives following errors

    [INFO] ------------------------------------------------------------------------
[INFO] Building dukes-store 7.0.5
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ dukes-store ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/yogesh/Downloads/glassfish4/docs/javaee-tutorial/examples/case-studies/dukes-forest/dukes-store/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ dukes-store ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- exec-maven-plugin:1.2.1:exec (default) @ dukes-store ---
Authentication failed for user: null
(Usually, this means invalid user name and/or password)
Command set failed.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] dukes-forest ....................................... SUCCESS [  1.007 s]
[INFO] events ............................................. SUCCESS [  1.257 s]
[INFO] entities ........................................... SUCCESS [  1.925 s]
[INFO] dukes-resources .................................... SUCCESS [  0.064 s]
[INFO] dukes-payment ...................................... SUCCESS [  3.276 s]
[INFO] dukes-store ........................................ FAILURE [  1.706 s]
[INFO] dukes-shipment ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.568 s
[INFO] Finished at: 2016-02-21T02:00:34+05:30
[INFO] Final Memory: 14M/183M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project dukes-store: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [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 <goals> -rf :dukes-store

Here is pom.xml for duke -store

<?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>

<parent>
    <groupId>org.glassfish.javaeetutorial</groupId>
    <artifactId>dukes-forest</artifactId>
    <version>7.0.5</version>
</parent>

<groupId>org.glassfish.javaeetutorial</groupId>
<artifactId>dukes-store</artifactId>
<packaging>war</packaging>

<name>dukes-store</name>

<dependencies>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>events</artifactId>
        <version>${project.version}</version>
    </dependency>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>entities</artifactId>
        <version>${project.version}</version>
    </dependency>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>dukes-payment</artifactId>
        <version>${project.version}</version>
        <type>war</type>
    </dependency>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>dukes-resources</artifactId>
        <version>${project.version}</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>${maven.exec.plugin.version}</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <skip>false</skip>
                <executable>/home/yogesh/Downloads/glassfish4/bin/asadmin${glassfish.executables.suffix}</executable>
                <arguments>
                    <argument>set</argument>
                    <argument>server.security-service.activate-default-principal-to-role-mapping=true</argument>
                    <argument>server.http-service.sso-enabled=true</argument>
                </arguments>
            </configuration>
        </plugin>          
    </plugins>

</build>

</project>

Solution

  • The relevant error in your output is this:

    Authentication failed for user: null (Usually, this means invalid user name and/or password)
    

    This error is generated when the exec-maven-plugin is run. This plugin is configured to execute asadmin. You probably created a password for the admin user. The exec-maven-plugin does not know that, so it cannot succesfully execute the asadmin command. Add the following to the <arguments> section:

    <argument>--user=admin</argument>
    <argument>--passwordfile=myprivatefile.txt</argument>
    

    Where myprivatefile.txt is a passwordfile that should look like this