我正在尝试运行官方Java EE 7 Tutorial代码示例并获取错误。我在这里已经阅读过,大多数结果表明你必须检查你的Maven插件目标是否与系统JDK环境变量相同。我的JDK_HOME是:
这是我的父母POM.XML:
<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</groupId>
<artifactId>javaeetutorial</artifactId>
<version>7.0.5</version>
<packaging>pom</packaging>
<name>javaeetutorial</name>
<scm>
<connection>scm:svn:https://svn.java.net/svn/javaeetutorial~svn/tags/javaeetutorial-7.0.0</connection>
<developerConnection>scm:svn:https://svn.java.net/svn/javaeetutorial~svn/tags/javaeetutorial-7.0.0</developerConnection>
</scm>
<issueManagement>
<system>IssueTracker</system>
<url>http://java.net/jira/browse/JAVAEETUTORIAL</url>
</issueManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javaee.api.version>7.0</javaee.api.version>
<maven.compiler.plugin.version>3.2</maven.compiler.plugin.version>
<maven.source.plugin.version>2.2.1</maven.source.plugin.version>
<maven.clean.plugin.version>2.5</maven.clean.plugin.version>
<maven.war.plugin.version>2.3</maven.war.plugin.version>
<maven.acr.plugin.version>1.0</maven.acr.plugin.version>
<maven.ear.plugin.version>2.8</maven.ear.plugin.version>
<maven.ejb.plugin.version>2.3</maven.ejb.plugin.version>
<maven.jar.plugin.version>2.4</maven.jar.plugin.version>
<maven.rar.plugin.version>2.3</maven.rar.plugin.version>
<maven.license.plugin.version>1.10.b1</maven.license.plugin.version>
<maven.release.plugin.version>2.4.1</maven.release.plugin.version>
<maven.exec.plugin.version>1.2.1</maven.exec.plugin.version>
<junit.version>4.11</junit.version>
<eclipselink.version>2.5.0</eclipselink.version>
<glassfish.embedded.version>4.0</glassfish.embedded.version>
<cargo.plugin.version>1.4.4</cargo.plugin.version>
<glassfish.domain.name>domain1</glassfish.domain.name>
<glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>
<integration.container.id>glassfish4x</integration.container.id>
</properties>
<profiles>
<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>
<profile>
<id>unix</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<glassfish.home.prefix>${user.home}</glassfish.home.prefix>
<glassfish.executables.suffix />
</properties>
</profile>
<profile>
<id>sdk</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<glassfish.home>${basedir}/../../../</glassfish.home>
</properties>
</profile>
<profile>
<id>development</id>
<activation>
<file>
<exists>${basedir}/../bundle</exists>
</file>
</activation>
<properties>
<glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>
</properties>
</profile>
<profile>
<id>standalone</id>
<properties>
<glassfish.home>${basedir}/target/cargo/installs/glassfish</glassfish.home>
<cargo.maven.containerUrl>http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/latest-glassfish.zip</cargo.maven.containerUrl>
</properties>
</profile>
</profiles>
<modules>
<module>archetypes</module>
<module>batch</module>
<module>case-studies</module>
<module>cdi</module>
<module>concurrency</module>
<module>connectors</module>
<module>ejb</module>
<module>jaxrs</module>
<module>jaxws</module>
<module>jms</module>
<module>persistence</module>
<module>security</module>
<module>web</module>
</modules>
<repositories>
<repository>
<id>snapshot-repository.java.net</id>
<name>Java.net Snapshot Repository for Maven</name>
<url>https://maven.java.net/content/repositories/staging/</url>
<layout>default</layout>
</repository>
<repository>
<id>releases-repository.java.net</id>
<name>Java.net releases Repository for Maven</name>
<url>https://maven.java.net/content/repositories/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven.source.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.clean.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${cargo.plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>deploy</id>
<phase>integration-test</phase>
<goals>
<goal>redeploy</goal>
</goals>
</execution>
</executions>
<configuration>
<container>
<containerId>${integration.container.id}</containerId>
<type>installed</type>
<home>${glassfish.home}</home>
</container>
<configuration>
<type>existing</type>
<home>${glassfish.home}/glassfish/domains</home>
<properties>
<cargo.glassfish.domain.name>${glassfish.domain.name}</cargo.glassfish.domain.name>
<!--cargo.remote.username></cargo.remote.username-->
<cargo.remote.password />
</properties>
</configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</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>common/**</exclude>
<exclude>**/META-INF/**</exclude>
<exclude>**/WEB-INF/**</exclude>
<exclude>**/nbactions.xml</exclude>
<exclude>**/nb-configuration.xml</exclude>
<exclude>**/glassfish-resources.xml</exclude>
<exclude>**/simple-flow-flow.xml</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>${maven.release.plugin.version}</version>
<configuration>
<!--
During release:perform, enable the "sdk" profile
-->
<releaseProfiles>sdk</releaseProfiles>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee.api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
我的孩子POM.XML
<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>
<parent>
<artifactId>servlet</artifactId>
<groupId>org.glassfish.javaeetutorial</groupId>
<version>7.0.5</version>
</parent>
<groupId>org.glassfish.javaeetutorial</groupId>
<artifactId>hello2</artifactId>
<version>7.0.5</version>
<packaging>war</packaging>
<name>hello2</name>
</project>
运行MVN安装后,我收到错误:
任何帮助都将受到高度赞赏!
答案 0 :(得分:2)
您正在编译Program Files中的项目。 这些文件夹通常是写保护的。
将Glassfish重新安装到Document /文件夹中,其中读/写不是问题。
Maven并不倾向于拥有世界上最有用的错误消息 - 这里的问题不是找不到目录,似乎更像是无法创建目录!