Javaee7 tutorial中构建duke-forest失败的解决方案

- 1 min

错误代码

dukes-payment ..................................... FAILURE [4.308s]
...
Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy (deploy) on project dukes-store: 
Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.4:redeploy failed: 
GlassFish admin command failed: asadmin exited 1 -> [Help 1]

原因

由于不能找到Glassfish的正确路径导致的

解决方案

NetBeans8.2

默认glassfish安装路径为C:\glassfish4(windows系统)

1.打开项目 /javaee-tutorial/examples

打开example

2.打开项目javaeetutorial->项目文件->pom.xml

打开pom.xml

3.找到类似代码

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

4.添加代码

<glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>

5.修改为

<profile>
        <id>windows</id>
        <activation>
                <os>
                        <family>windows</family>
                </os>
        </activation>
        <properties>
                <glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>
                <glassfish.home.prefix>c:/</glassfish.home.prefix>
                <glassfish.executables.suffix>.bat</glassfish.executables.suffix>
        </properties>
</profile>

6.启动JavaDB

7.启动GlassFish Server

8.鼠标右键项目dukes-forest构建

构建

Dawson Lee

A man who loves to watch Korean dramas

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora