2016-03-15 4 views
0

Я пытаюсь запустить официальные примеры кода Java EE 7 Tutorial и получить сообщение об ошибке. Я прочитал об этом здесь, и большинство результатов говорят о том, что вы должны проверить, что ваша цель плагина Maven совпадает с вашей переменной среды JDK системы. Мой JDK_HOME является:Maven Fatal error compiling: directory not found: maven-compiler-plugin

jdk home image

Вот мой родитель 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 установить я получаю ошибку:

enter image description here

Любая помощь будет высоко ценится!

+0

Вы компилируете проект внутри своих программных файлов, который выглядит очень подозрительно. Эти папки часто защищены от записи. Скопируйте свои источники, например. папку вашего документа и повторите попытку? –

+0

Теперь я вижу, что в учебнике говорится, что вы не должны использовать стеклянную рыбку, встроенную в Netbeans. :(Звучит так, может быть, проблема. Будет переустанавливать стеклянную рыбу отдельно и возвращаться назад. – Arnie

+0

Сделал это и сработало - большое спасибо. Можете ли вы опубликовать его в качестве ответа, и я проголосую за него. интересно, почему Oracle хочет, чтобы мы установили примеры из учебного центра Glassfish, а не отдельно. – Arnie

ответ

1

Вы компилируете проект внутри своих программных файлов. Эти папки часто защищаются от записи.

Заново установите Glassfish в папку Document, где чтение/запись не является проблемой.

Maven не имеет наиболее полезных сообщений об ошибках в мире - здесь проблема не в том, что каталог не найден, похоже, что каталог не может быть создан!