无法执行目标org.codehaus.cargo:cargo-maven2-plugin:1.4.4:重新部署(部署)项目公爵辅导

时间:2016-02-18 21:11:07

标签: java maven netbeans-8 glassfish-4 java-ee-7

Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy (deploy) on project dukes-tutoring-war: Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy failed: Failed to create deployer with implementation class org.codehaus.cargo.container.glassfish.GlassFish4xInstalledLocalDeployer for the parameters (container [id = [glassfish4x]], deployer type [installed]). InvocationTargetException: The container configuration directory "/home/yogesh/Downloads/glassfish4/glassfish4/glassfish/domains" does not exist. Please configure the container before attempting to perform any local deployment. Read more on: http://cargo.codehaus.org/Local+Configuration -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

After correcting the problems, you can resume the build with the command
  mvn <goals> -rf :dukes-tutoring-war

我的pom.xml来自dukes-tutoring-war ---------

<?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>
        <artifactId>dukes-tutoring</artifactId>
        <groupId>org.glassfish.javaeetutorial</groupId>
        <version>7.0.5</version>
    </parent>

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

    <name>dukes-tutoring-war</name>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dukes-tutoring-common</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>
                        <id>create-tutoring-realm</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skip>false</skip>
                    <executable>/home/yogesh/Downloads/glassfish4/glassfish/bin/asadmin${glassfish.executables.suffix}</executable>
                    <arguments>
                        <argument>create-auth-realm</argument>
                        <argument>--classname</argument>
                        <argument>com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm</argument>
                        <argument>--property</argument>
                        <argument>jaas-context=jdbcRealm:datasource-jndi='java:global/TutoringDataSource':user-table=tutoring.PERSON:user-name-column=email:password-column=password:group-table=tutoring.PERSON:group-name-column=DTYPE:digest-algorithm=none</argument>
                        <argument>tutoringRealm</argument>
                    </arguments>
                    <successCodes>
                        <successCode>0</successCode>
                        <successCode>1</successCode>
                    </successCodes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

<glassfish.home.prefix>设置的示例文件夹中的pom

<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>org.glassfish.javaeetutorial</groupId>
    <artifactId>javaeetutorial</artifactId>
    <version>7.0.5</version>
    <packaging>pom</packaging>
    <name>javaeetutorial</name>

    <scm>
        <connection>scm:svn:https://svn.java.net/svn/javaeetutorial~svn/tags/javaeetutorial-7.0.0</connection>
        <developerConnection>scm:svn:https://svn.java.net/svn/javaeetutorial~svn/tags/javaeetutorial-7.0.0</developerConnection>
    </scm>
    <issueManagement>
        <system>IssueTracker</system>
        <url>http://java.net/jira/browse/JAVAEETUTORIAL</url>
    </issueManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <javaee.api.version>7.0</javaee.api.version>
        <maven.compiler.plugin.version>3.1</maven.compiler.plugin.version>
        <maven.source.plugin.version>2.2.1</maven.source.plugin.version>
        <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
        <maven.war.plugin.version>2.3</maven.war.plugin.version>
        <maven.acr.plugin.version>1.0</maven.acr.plugin.version>
        <maven.ear.plugin.version>2.8</maven.ear.plugin.version>
        <maven.ejb.plugin.version>2.3</maven.ejb.plugin.version>
        <maven.jar.plugin.version>2.4</maven.jar.plugin.version>
        <maven.rar.plugin.version>2.3</maven.rar.plugin.version>
        <maven.license.plugin.version>1.10.b1</maven.license.plugin.version>
        <maven.release.plugin.version>2.4.1</maven.release.plugin.version>
        <maven.exec.plugin.version>1.2.1</maven.exec.plugin.version>
        <junit.version>4.11</junit.version>
        <eclipselink.version>2.5.0</eclipselink.version>
        <glassfish.embedded.version>4.0</glassfish.embedded.version>
        <cargo.plugin.version>1.4.4</cargo.plugin.version>
        <glassfish.domain.name>domain1</glassfish.domain.name>
        <glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>
        <integration.container.id>glassfish4x</integration.container.id>
    </properties>

    <profiles>
        <profile>
            <id>windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <glassfish.home.prefix>c:/</glassfish.home.prefix>
                <glassfish.executables.suffix>.bat</glassfish.executables.suffix>
            </properties>
        </profile>
        <profile>
            <id>unix</id>
            <activation>
                <os>
                    <family>unix</family>
                </os>
            </activation>
            <properties>
                <glassfish.home.prefix>/home/yogesh/Downloads/glassfish4</glassfish.home.prefix>
                <glassfish.executables.suffix />
            </properties>
        </profile>
        <profile>
            <id>sdk</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <glassfish.home>${basedir}/../../../</glassfish.home>
            </properties>
        </profile>
        <profile>
            <id>development</id>
            <activation>
                <file>
                    <exists>${basedir}/../bundle</exists>
                </file>
            </activation>
            <properties>
                <glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>
            </properties>
        </profile>
        <profile>
            <id>standalone</id>
            <properties>
                <glassfish.home>${basedir}/target/cargo/installs/glassfish</glassfish.home>
                <cargo.maven.containerUrl>http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/latest-glassfish.zip</cargo.maven.containerUrl>
            </properties>
        </profile>
    </profiles>

    <modules>
        <module>archetypes</module>
        <module>batch</module>
        <module>case-studies</module>
        <module>cdi</module>
        <module>concurrency</module>
        <module>connectors</module>
        <module>ejb</module>
        <module>jaxrs</module>
        <module>jaxws</module>
        <module>jms</module>
        <module>persistence</module>
        <module>security</module>
        <module>web</module>
    </modules>

    <repositories>
        <repository>
            <id>snapshot-repository.java.net</id>
            <name>Java.net Snapshot Repository for Maven</name>
            <url>https://maven.java.net/content/repositories/staging/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>releases-repository.java.net</id>
            <name>Java.net releases Repository for Maven</name>
            <url>https://maven.java.net/content/repositories/releases/</url>
            <layout>default</layout>
        </repository>
    </repositories>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven.source.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven.clean.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven.war.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>${cargo.plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <inherited>true</inherited>
                <executions>
                    <execution>
                        <id>deploy</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>redeploy</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <container>
                        <containerId>${integration.container.id}</containerId>
                        <type>installed</type>
                        <home>${glassfish.home}</home>
                    </container>
                    <configuration>
                        <type>existing</type>
                        <home>${glassfish.home}/glassfish/domains</home>
                        <properties>
                            <cargo.glassfish.domain.name>${glassfish.domain.name}</cargo.glassfish.domain.name>
                            <!--cargo.remote.username></cargo.remote.username-->
                            <cargo.remote.password />
                        </properties>
                    </configuration>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.mycila.maven-license-plugin</groupId>
                <artifactId>maven-license-plugin</artifactId>
                <version>${maven.license.plugin.version}</version>
                <configuration>
                    <header>common/license.txt</header>
                    <excludes>
                        <exclude>common/**</exclude>
                        <exclude>**/META-INF/**</exclude>
                        <exclude>**/WEB-INF/**</exclude>
                        <exclude>**/nbactions.xml</exclude>
                        <exclude>**/nb-configuration.xml</exclude>
                        <exclude>**/glassfish-resources.xml</exclude>
                        <exclude>**/simple-flow-flow.xml</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven.release.plugin.version}</version>
                <configuration>
                    <!--
                     During release:perform, enable the "sdk" profile
                    -->
                    <releaseProfiles>sdk</releaseProfiles>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>${javaee.api.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>

我的glassfish4位置:/ home / yogesh / Downloads / glassfish4 apache maven位置:/opt/apache-maven-3.3.9

2 个答案:

答案 0 :(得分:0)

当我尝试构建hello1项目时,我遇到了类似的问题,这主要是因为我使用 glassfish安装了 Netbeans :我想你做了同样的事情。

我不太确定,但是在尝试构建项目时,安装带有glassfish的Netbeans会导致一些路径问题。

这就是我在openSUSE Leap计算机上解决的问题:

  1. 如果Glassfish服务器正在运行并关闭您的Netbeans IDE,请将其停止

  2. 打开终端并卸载glassfish

    cd / path / to / glassfish / installation / directory(例如:cd~ / glassfish-4.1.1)

    ./ uninstall.sh

  3. http://www.oracle.com/technetwork/java/javaee/downloads/index.html下载 Java EE 7 SDK Update 2 (或最新更新)

  4. 解压缩下载的文件(这会创建glassfish4目录)

    cd / path / to / downloaded / file / directory

    解压缩java_ee_sdk-7u2.zip

  5. 在此阶段,已经安装了glassfish服务器,但它尚未集成到Netbeans IDE中(您会发现它未在Netbeans IDE中列为服务器)。有关如何在Netbeans IDE中将glassfish服务器添加为服务器的说明,请访问:https://docs.oracle.com/cd/E19798-01/821-1770/gioew/

  6. 您现在可以打开Netbeans IDE并尝试重新构建项目;你应该像我一样建立成功

  7. 我真的希望这会有所帮助。

答案 1 :(得分:0)

这也可能与您的glassfish服务器版本有关,我通过切换到glassfish4.1解决了相同的问题。

异常消息中的这一行:

(container [id = [glassfish4x]], deployer type [installed])

可能正在搜索glassfish4版本,