对Glassfish服务器的部署失败,因为Cargo插件具有无效属性。 我有一个带有这个父pom的多模块Maven项目:
<?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.skb</groupId>
<artifactId>ProjectMonkeybutler</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ProjectMonkeybutler</name>
<modules>
<module>ProjectMonkeybutler-ear</module>
<module>ProjectMonkeybutler-web</module>
<module>ProjectMonkeybutler-ejb</module>
</modules>
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>4.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
我想对我的Glassfish服务器执行自动重新部署,但这不可能来自父pom,因为它不是将生成的war / ear文件。我将Cargo插件集成到耳朵项目中,但部署不成功。
我的耳朵项目的pom.xml。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" x mlns: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>ProjectMonkeybutler</artifactId>
<groupId>com.skb</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.skb.monkeybutler.ear</groupId>
<artifactId>ProjectMonkeybutler-ear</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ear</packaging>
<name>ProjectMonkeybutler-ear</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<configuration>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.7</version>
<configuration>
<container>
<containerId>glassfish4x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.hostname>localhost</cargo.hostname>
<cargo.remote.username>admin</cargo.remote.username>
<cargo.remote.password>password</cargo.remote.password>
<cargo.remote.port>50447</cargo.remote.port>
<cargo.glassfish.domain.name>/domain1</cargo.glassfish.domain.name>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>ear</type>
<properties>
<context>/monkeybutler-dev</context>
</properties>
</deployable>
</deployables>
</configuration>
<dependencies>
<dependency>
<groupId>org.glassfish.deployment</groupId>
<artifactId>deployment-client</artifactId>
<version>3.2-b06</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.skb</groupId>
<artifactId>ProjectMonkeybutler-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>com.skb</groupId>
<artifactId>ProjectMonkeybutler-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
之后的错误
mvn cargo:deploy
ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.7:redeploy (default-cli) on project ProjectMonkeybutler-ear: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.7:redeploy failed: Invalid property [context] for deployable type [ear]: org.codehaus.cargo.container.deployable.EAR.setContext([Ljava.lang.String;) -> [Help 1]
答案 0 :(得分:0)
仅允许WAR使用context属性。
请参阅文档中的Deployable Type
列<{3}}