Bamboo Maven Glassfish 部署
Posted
技术标签:
【中文标题】Bamboo Maven Glassfish 部署【英文标题】:Bamboo Maven Glassfish Deploy 【发布时间】:2014-03-07 16:42:15 【问题描述】:我一直在尝试为 Java EE 应用程序设置持续集成和部署。 持续集成有效,但部署总是失败。
我在 maven 参数 $local.glassfish.passfile 中尝试了 3 件事:
-
域密码的路径
.gfclient/pass 的路径
密码字符串
我尝试的最后一件事是:
- pom.xml 中的硬编码值
耳朵 pom.xml 配置:
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>$local.glassfish.home</glassfishDirectory>
<user>$local.glassfish.user</user>
<passwordFile>$local.glassfish.passfile</passwordFile>
<domain>
<name>$local.glassfish.domain</name>
<adminPort>$local.glassfish.adminPort</adminPort>
<httpPort>$local.glassfish.httpPort</httpPort>
</domain>
<components>
<component>
<name>$project.artifactId</name>
<artifact>target/$project.build.finalName.ear</artifact>
</component>
</components>
<debug>true</debug>
<terse>false</terse>
<echo>true</echo>
</configuration>
</plugin>
通过终端在ear文件夹内运行 mvn glassfish:deploy 成功将ear artefact部署到服务器。
Bamboo 错误日志:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ear 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-glassfish-plugin:2.1:undeploy (default-cli) @ ear ---
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --echo --terse=false --interactive=false --user admin --passwordfile /home/guest/.gfclient/pass --host localhost --port 55004 undeploy [options] ...
[INFO] asadmin --host localhost --port 55004 --user admin --passwordfile /home/guest/.gfclient/pass --interactive=false --echo=true --terse=false undeploy --keepreposdir=false --isredeploy=false --cascade=false --_ignorecascade=false --_classicstyle=false ear
[INFO] Command undeploy failed.
[ERROR] Authentication failed for user: admin
[ERROR] (Usually, this means invalid user name and/or password)
[ERROR] Undeployment of ear failed.
[ERROR] For more detail on what might be causing the problem try running maven with the --debug option
[ERROR] or setting the maven-glassfish-plugin "echo" property to "true".
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.699 s
[INFO] Finished at: 2014-03-06T17:39:50+00:00
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:undeploy (default-cli) on project ear: Undeployment of ear failed. -> [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/MojoFailureException
Failing task since return code of [/home/guest/apache-maven-3.2.1/bin/mvn glassfish:undeploy] was 1 while expected 0
Finished task 'Maven Glassfish Undeploy'
请注意,为了更新密码文件,我在更改管理员密码后运行了“asadmin login”命令。
guest@foo:~$ asadmin --port 55004 login
Enter admin user name [Enter to accept default]> admin
Enter admin password>
Admin login information for host [localhost] and port [55004] is being overwritten with credentials provided. This is because the --savelogin option was used during create-domain command.
Login information relevant to admin user name [admin] for host [localhost] and admin port [55004] stored at [/home/guest/.gfclient/pass] successfully.
Make sure that this file remains protected. Information stored in this file will be used by administration commands to manage associated domain.
Command login executed successfully.
另外,Glassfish 版本是 4.0,Maven 版本是 3.2.1。
【问题讨论】:
你试过在 maven 配置文件中设置用户/密码吗?见 maven.home/conf/settings.xml 【参考方案1】:如果您使用了 asadmin login 命令,则无需在 undeploy 和 deploy 命令中指定用户和密码,因为它将使用您使用 login 命令设置的凭据。
【讨论】:
【参考方案2】:有一个 Bamboo 插件允许将战争文件部署到 Glassfish 应用服务器。 https://marketplace.atlassian.com/apps/1219234/tasks-for-glassfish-server
【讨论】:
以上是关于Bamboo Maven Glassfish 部署的主要内容,如果未能解决你的问题,请参考以下文章