简体   繁体   中英

maven-compiler-plugin 3.2 compile error: cannot find symbol

On my local machine maven deploy war to wildfly application server successful using mvn wildfly:deploy command on ubuntu 14.10,maven 3.13 and wildfly 8.2, but when my partner try deploy in remote server get this error:

...
[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>

you need to add this to your pom.xml

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM