我想从父 pom 部署到 glassfish4,但我总是收到以下错误消息:
No plugin found for prefix 'glassfish' in the current project and in the plugin groups
[org.apache.maven.plugins, org.codehaus.mojo] available from the repositories
[local (c:\Programs\Server\.m2\repository), central (http://repo.maven.apache.org/maven2)]
我的父 pom 有几个模块,对于其中两个,我想将一个 war 文件部署到 glassfish。如果我将插件代码写入模块 pom 并仅执行该模块,它就可以工作。但是如果我将它移动到配置文件中的父 pom,以便我只为设置了特殊属性的模块执行它,maven 找不到插件。
父-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.firstcup</groupId>
<artifactId>firstcup</artifactId>
<version>7.0.1</version>
<packaging>pom</packaging>
<name>firstcup</name>
<scm>
<connection>scm:svn:https://svn.java.net/svn/firstcup~svn/tags/firstcup-7.0.1</connection>
<developerConnection>scm:svn:https://svn.java.net/svn/firstcup~svn/tags/firstcup-7.0.1</developerConnection>
</scm>
<issueManagement>
<system>IssueTracker</system>
<url>http://java.net/jira/browse/FIRSTCUP</url>
</issueManagement>
<modules>
<module>firstcup-war</module>
<module>dukes-age</module>
<module>archetypes</module>
</modules>
<properties>
<javaee.api.version>7.0</javaee.api.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.plugin.version>3.1</maven.compiler.plugin.version>
<maven.war.plugin.version>2.3</maven.war.plugin.version>
<maven.license.plugin.version>1.10.b1</maven.license.plugin.version>
<deploy.glassfish>false</deploy.glassfish>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</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>**/META-INF/**</exclude>
<exclude>**/WEB-INF/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>deploy-glassfish</id>
<activation>
<property>
<name>deploy.glassfish</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<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>
<httpPort>${local.glassfish.httpport}</httpPort>
<adminPort>${local.glassfish.adminport}</adminPort>
</domain>
<components>
<component>
<name>${project.name}</name>
<artifact>target/${project.name}-${project.version}.war</artifact>
</component>
</components>
<debug>true</debug>
<terse>false</terse>
<echo>true</echo>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee.api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>java.net-maven2-repository</id>
<name>Java.net Repository for Maven</name>
<url>https://maven.java.net/content/repositories/staging/</url>
<layout>default</layout>
</repository>
<repository>
<id>Java EE 7</id>
<url>https://maven.java.net/content/groups/promoted/</url>
</repository>
</repositories>
儿童pom:
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>firstcup</artifactId>
<groupId>org.glassfish.javaeetutorial.firstcup</groupId>
<version>7.0.1</version>
</parent>
<artifactId>dukes-age</artifactId>
<groupId>org.glassfish.javaeetutorial.firstcup</groupId>
<packaging>war</packaging>
<name>dukes-age</name>
<properties>
<deploy.glassfish>true</deploy.glassfish>
</properties>