Maven无法编译

我是Maven的新手,无法理解如何从正在运行的书(O'Reilly的“ Enterprise JavaBeans 3.1”)中获取一些示例。它说使用命令“ mvn clean install”运行示例,但对我来说不起作用。当我转到pom.xml所在的文件夹时,会收到以下反馈:

$ mvn clean install[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building JBoss EJB 3.x Examples - Chapter 4: Calculator Service EJBs 1.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jboss-ejb3-examples-ch04-firstejb ---
[INFO] Deleting /Users/jonathanpomper/Desktop/oreilly-ejb-6thedition-book-examples-master/ch04-firstejb/target
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (enforce-maven-environment) @ jboss-ejb3-examples-ch04-firstejb ---
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ jboss-ejb3-examples-ch04-firstejb ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/jonathanpomper/Desktop/oreilly-ejb-6thedition-book-examples-master/ch04-firstejb/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ jboss-ejb3-examples-ch04-firstejb ---
[INFO] Compiling 11 source files to /Users/jonathanpomper/Desktop/oreilly-ejb-6thedition-book-examples-master/ch04-firstejb/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac,  but could not parse the error:
/bin/sh: /bin/javac: No such file or directory

[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.530s
[INFO] Finished at: Mon Mar 10 18:17:56 EDT 2014
[INFO] Final Memory: 27M/218M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project jboss-ejb3-examples-ch04-firstejb: Compilation failure
[ERROR] Failure executing javac,  but could not parse the error:
[ERROR] /bin/sh: /bin/javac: No such file or directory
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我尝试按照它提供的帮助链接进行操作,但是我陷于困境……任何帮助都将非常棒!提前致谢!

编辑:这是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/maven-v4_0_0.xsd">

  <!-- Parent Information -->
  <parent>
   <groupId>org.jboss.ejb3.examples</groupId>
   <artifactId>jboss-ejb3-examples-build</artifactId>
   <version>1.1.0-SNAPSHOT</version>
  <relativePath>../build/pom.xml</relativePath>
  </parent>

  <!-- Model Version -->
  <modelVersion>4.0.0</modelVersion>

  <!-- Artifact Information -->
  <artifactId>jboss-ejb3-examples-ch04-firstejb</artifactId>
  <name>JBoss EJB 3.x Examples - Chapter 4: Calculator Service EJBs</name>
  <description>Example to accompany O'Reilly "Enterprise Java Beans 6th Edition" Chapter 4</description>

<dependency>
  <groupId>org.jboss.as</groupId>
  <artifactId>jboss-as-spec-api</artifactId>
  <type>pom</type>
</dependency>

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
</dependency>

<!-- Arquillian Test Harness -->
<dependency>
  <groupId>org.jboss.as</groupId>
  <artifactId>jboss-as-arquillian-container-managed</artifactId>
</dependency>
<dependency>
  <groupId>org.jboss.arquillian.junit</groupId>
  <artifactId>arquillian-junit-container</artifactId>
</dependency>
<dependency>
  <groupId>org.jboss.as</groupId>
  <artifactId>jboss-as-dist</artifactId>
  <type>zip</type>
  <scope>test</scope>
</dependency>

        <!-- 
HACK:
Currently the ARQ Managed Container is not exporting
all deps needed to run, at a minimum, jboss-threads
AS7-1557
-->
<dependency>
  <groupId>org.jboss.as</groupId>
  <artifactId>jboss-as-build</artifactId>
  <type>pom</type>
  <scope>test</scope>
  <exclusions>
    <exclusion>
      <groupId>javax.faces</groupId>
      <artifactId>jsf-impl</artifactId>
    </exclusion>
    <exclusion>
      <groupId>xalan</groupId>
      <artifactId>serializer</artifactId>
    </exclusion>
  </exclusions>
</dependency>

<profile>

  <!-- Declare the "Integration Test" Profile -->
  <id>it</id>
  <activation>
    <activeByDefault>true</activeByDefault>
  </activation>

  <build>

    <plugins>

      <!-- Get AS and put into "target" -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>pre-integration-test</phase> <!-- So run before testing -->
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.jboss.as</groupId>
                  <artifactId>jboss-as-dist</artifactId>
                  <version>${version.org.jboss.as.7}</version>
                  <type>zip</type>
                  <overWrite>false</overWrite>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>


      <!-- Surefire -->
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>integration-test</id>
            <phase>integration-test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
              <trimStackTrace>false</trimStackTrace>
              <printSummary>true</printSummary>
              <includes>
                <include>**/*IntegrationTestCase.java</include>
              </includes>
              <forkMode>once</forkMode>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

</profile>

没有正确设置Java_Home。现在工作!

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章