maven-compiler-plugin 3.2编译错误:找不到符号

时间:2015-11-16 07:35:21

标签: java maven

在我的本地机器上,使用ubuntu 14.10,maven 3.13和wildfly 8.2上的mvn wildfly:deploy命令成功地向wildfly应用服务器部署war,但是当我的伙伴尝试在远程服务器中部署时出现此错误:

...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-  compiler-plugin:3.2:compile (default-compile) on project test1: Compilation failure: Compilation failure:
[ERROR] /var/lib/jenkins/jobs/serviceProject/workspace/src/main/java/com/rest/counter/CountersBean.java:[6,17] cannot find symbol
[ERROR] symbol:   class LocalBean
[ERROR] location: package javax.ejb
[ERROR] /var/lib/jenkins/jobs/serviceProject/workspace/src/main/java/com/rest/counter/CountersBean.java:[10,2] cannot find symbol
[ERROR] symbol: class LocalBean
[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:

的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>com.test</groupId>
  <artifactId>test1</artifactId>
  <version>1.0</version>
  <packaging>war</packaging>
  <properties>
        <jboss_home>{JBOSS_HOME}</jboss_home>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>


  <repositories>
    <repository>
        <id>JBoss repository</id>
        <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
    </repository>
  </repositories>

  <dependencies>

    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

    <dependency>
        <groupId>javax.ejb</groupId>
        <artifactId>ejb-api</artifactId>
        <version>3.0</version>
    </dependency>

    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
        <version>3.0.13.Final</version>
        <scope>provided</scope>
    </dependency>

    ...

  </dependencies>

    <build>
        <finalName>counterService</finalName>
        <plugins>
            <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <version>1.1.0.Alpha4</version>
                        <configuration>
                                <jboss-home>{$jboss_home}</jboss-home>
                        </configuration>
                </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
    </plugins>
    </build>
</project>

1 个答案:

答案 0 :(得分:1)

您需要将其添加到pom.xml

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
</dependency>