0
votes

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;
3
Price.java:[1,14] unmappable character for encoding UTF-8.. Did you read the exception... you have a character not mapped in UTF-8 in Price.java and various other .java files..Please provide a code snipper of this class for further helpKaustubh Kallianpur
Thanks for your comment, I've removed some special character in Price.java and Availibility.java. But other error still showingLê Quang Bảo
Check the messages: Property.java:[5,36] package javax.validation.constraints does not exist and [ERROR] symbol: class NotNull. -- You have an import javax.validation.constraints.NotNull; but you do not have the corresponding dependency in the pom.xml. -- You may look for the maven dependency.Jaime

3 Answers

4
votes
  • 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.
0
votes

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.

0
votes

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.