VSCode / Java version

Confluence User - 02 May, 2019

Hello,

I loaded jw-community in VSCode (with no changes to the standard java settings). I get errors on certain files, for examples:

@Override
public int compare(JSONObject a, JSONObject b) {

This gives an error:  

The method compare(JSONObject, JSONObject) of type new Comparator<JSONObject>(){} must override a superclass method

The reason is that from Java v6, it was allowed to use '@Override' for implementing an interface, whereas prior to this, this is an error.

In all the pom.xml files, Java version is 5:

 <plugin>
     <artifactId>maven-compiler-plugin</artifactId>
     <version>2.0.2</version>
     <configuration>
        <source>1.5</source>
        <target>1.5</target>
     </configuration>
 </plugin>



So it looks like VSCode is "right" to give this error if it used java v5 to compile. It is surprising that the project uses Java v5 and it would seem like these settings are not being used in the normal build process using mvn, but I don't see how.

Has anyone managed to get jw-community to work with VSCode? What am I missing in the way the java versions are setup in maven?

java;developer_environment

2


03 May, 2019
confluenceUser
confluenceUser

Hi, I do not use VSCode but I am able to build the project successfully using Maven. Do you have problems building? Perhaps you could try to change the maven-compiler-plugin configuration to 1.6 or 1.7 to see if it helps in your environment.

03 May, 2019
confluenceUser
confluenceUser

Thanks  Anders, actually it also works for me when I run it with Maven, but I am not sure why (smile) because the version number looks wrong. I was wondering which configuration Maven uses to override. these settings in the individual pm.xml files - that could help me to get VSCode to replicate this. I can also. try your suggestion to bump the version number, but didn't want to stray too far from the master on the build configuration.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print