0
我正在嘗試使用Maven,Glassfish和Maven-Glassfish插件來設置基本的部署管道。我想在我自己的遠程Glassfish服務器上遠程部署.war。使用Maven和Glassfish進行簡單的遠程部署
我被困在了一步,當我不得不運行AA Maven的目標如下目標:
properties:read-project-properties clean install glassfish:redeploy -e
具有以下屬性:
glassfish.properties.file.argument=testing
pom.xml中看起來是這樣的:
<?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.blogpost</groupId>
<artifactId>HelloGlassFishMaven</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>HelloGlassFishMaven</name>
<properties>
<!-- Input Parameter - GlassFish properties file -->
<glassfish.properties.file.argument></glassfish.properties.file.argument>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
<webresources>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetpath>WEB-INF</targetpath>
<includes>
<include>**/glassfish-web.xml</include>
</includes>
</resource>
</webresources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<configuration>
<files>
<file>${basedir}/properties/${glassfish.properties.file.argument}.properties</file>
</files>
</configuration>
</plugin>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>D:\CreepyStation\Work\Virtual environment\GlassFishInpuJavaEE\glassfish</glassfishDirectory>
<user>${glassfish.user}</user>
<passwordFile>${basedir}/passwords/${glassfish.pwdfile}</passwordFile>
<echo>true</echo>
<debug>true</debug>
<terse>true</terse>
<domain>
<name>${glassfish.domain}</name>
<host>${glassfish.host}</host>
<adminPort>${glassfish.adminport}</adminPort>
<httpPort>6061</httpPort>
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
</plugin>
</plugins>
</build>
</project>
它使用的.properties以下參數文件(我的遠程Glassfish的域)
# GlassFish 4 testing domain properties
glassfish.domain=testing
glassfish.host=XX.XX.XX.XX
glassfish.adminport=6060
glassfish.user=admin
glassfish.pwdfile=pwdfile_testing
至於我的理解:
- 它正確地連接到我的遠程Glassfishserver(如果我更改密碼屬性文件,它警告我,用戶名/密碼不正確)
- 我已經正確配置我的遠程Glassfish服務器的域名爲「測試」,並啓用安全管理已激活,我可以訪問我的服務器與格拉斯sfish admin GUI。
- 如果我在Glassfish管理GUI上部署.war,它就可以工作。
它掛了幾分鐘,給我一個錯誤,這裏的錯誤日誌(批號線,因爲我已經actived調試,錯誤是在文件的結尾):
這讓我瘋狂,我花了無數小時試圖弄清楚,到目前爲止沒有運氣。
非常感謝!