Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To see messages from Sonar introduced by edits made in the projects, select "Window -> Show Wiew -> Other...". Expand "SonarLint" and select "SonarLint -> On-The-Fly".

Setting up the ONAP Checkstyle in Eclipse

(There may well be an easier way but this works)

The first issue is that the current ONAP master tagged versino of the checkstyle does not work with Eclipse Oxygen/Photon (and maybe other versions) because of the "curly bracket" issue. There is a fix on the way but it's not here yet. The current tagged version of oparent we are using in Policy is 1.2.1.

Hack oparent to fix "curly bracket" issue

To get around this issue, check out oparent, checked out the 1.2.1 tag, fixed the "curly bracket" bug and built it on my local machine.

  1. Check out oparent
  2. git tag -l
  3. git co tags/1.2.1 -b 1.2.1
  4.  edit checkstyle/src/main/resources/onap-checkstyle/onap-java-style.xml, fix bug
    -            <property name="maxLineLength" value="120"/>
    +            <!--property name="maxLineLength" value="120"/-->
  5. The versions in the POMs in oparent are snapshot, so we need to change those to 1.2.1
     mvn versions:set -DnewVersion=1.2.1
  6. Now build locally:
    mvn clean install

Set "ONAP" configuration in Eclipse

To set the newly built checkstyle files in Eclipse:

  1. Preferences->Checkstyle
  2. Click "New"
  3. Select "External Configuration File"
  4. Give it a name eg ONAP
  5. Point at the file eg: /home/liam/git/onap/oparent/checkstyle/src/main/resources/onap-checkstyle/onap-java-style.xml
  6. Click OK
  7. Select "ONAP" configuration and click "Set as Default"
  8. Select "Apply and Close"

Apply "ONAP" configuration to a project in Eclipse

Now we need to activate the checkstyle on one project and set it as the blueprint for all of them:
Select a project in eclipse and right click->Properties->Checkstyle
check "Checkstyle active for this project"
Select the "ONAP" checkstyle profile
Click "Apply and Close"

Spread blueprint to other projects in Eclipse

Now spread the profile to all other projects:

  1. Select all the projects you want to apply the profile to in the Eclipse project explorer (not the one that you set up above)
  2. Right click->Checkstyle->Configure projects from blueprint
  3. Select the project you set up above
  4. Now all the projects have the correct checkstyle setup.

Sorry this was so long, how can something so simple be so complex!

IDE: IntelliJ

Installing Intellij Community Edition on Linux 

...