简体   繁体   中英

Maven build error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile

I try to build my team project with "mvn install" and got the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project domain: Compilation failure: Compilation failure:
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/property/Property.java:[5,36] package javax.validation.constraints does not exist
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/model/dto/MaintenanceDetails.java:[8,36] package javax.validation.constraints does not exist
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/property/service/PropertyService.java:[10,24] package javax.validation does not exist
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/property/Property.java:[15,6] cannot find symbol
[ERROR] symbol:   class NotNull
[ERROR] location: class nelson.domain.property.Property
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/property/Property.java:[16,6] cannot find symbol
[ERROR] symbol:   class NotNull
[ERROR] location: class nelson.domain.property.Property
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/property/Property.java:[17,6] cannot find symbol
[ERROR] symbol:   class NotNull
[ERROR] location: class nelson.domain.property.Property
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/model/dto/MaintenanceDetails.java:[15,6] cannot find symbol
[ERROR] symbol:   class NotNull
[ERROR] location: class nelson.domain.model.dto.MaintenanceDetails
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/model/dto/MaintenanceDetails.java:[16,6] cannot find symbol
[ERROR] symbol:   class NotNull
[ERROR] location: class nelson.domain.model.dto.MaintenanceDetails
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/model/dto/MaintenanceDetails.java:[17,6] cannot find symbol
[ERROR] symbol:   class NotNull
[ERROR] location: class nelson.domain.model.dto.MaintenanceDetails
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/model/dto/MaintenanceDetails.java:[18,6] cannot find symbol
[ERROR] symbol:   class NotNull
[ERROR] location: class nelson.domain.model.dto.MaintenanceDetails
[ERROR] /D:/Omena/nelson-api/domain/src/main/java/nelson/domain/property/service/PropertyService.java:[75,23] cannot find symbol

Here the pom.xml file, also I don't have the permission to change this file

<plugin>
    <artifactId>maven-deploy-plugin</artifactId>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>
<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
</plugin>

I've google a lot but no luck. For some reason, all answers about this problem surprisingly short and vague.

Update 1: UTF-8 problem solved (but there are still other error around)

Update 2: here detail import of Property.java

package nelson.domain.property;    
import java.io.Serializable;    
import javax.validation.constraints.NotNull;    
import nelson.common.util.Struct;
  • Add this dependency in your pom.xml- javax.validation validation-api:version
  • If you have already added and still it throws the exception then right click on your project -> maven -> Update project and check force update.

You seems to be missing a dependency "javax.validation:validation-api". If other in your project are able to build, make sure that if there is SNAPSHOT dependency on your main project that you checkout them and build them first to have all the changes in your local Maven repository. Also you can delete this dependency from you local Maven repo in case it didn't downloaded correctly, so you download it again.

The exception unmappable character for encoding UTF-8 .

This means that you have some Un-Idenfied Charectars. You need to check you .java Classes and remove the character whatever is present over there, must have been there due to some error.

I hope you have fixed that,

[ERROR] package javax.validation does not exist

You can check your pom.xml file for any dependency, and add the javax.validation dependency. You can find your required version of javax.validation API here , add the dependency to your pom.xml if it is missing.

If you already have that, there maybe an error with the Jar File download. Right click project

- Run as - Maven build - "clean compile install"

This should download your jar file, if missing. If you have javax.validation API in your pom.xml and still you get the error. download the jar file, for the required version from the same link provided above. add the jar file yourself.

Hope this works! Let us know for more help.

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