...
Click OK
Click "Apply and Close"
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.
- Check out oparent
- git tag -l
- git co tags/1.2.1 -b 1.2.1
- edit checkstyle/src/main/resources/onap-checkstyle/onap-java-style.xml, fix bug
- <property name="maxLineLength" value="120"/>
+ <!--property name="maxLineLength" value="120"/--> - 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 - Now build locally:
mvn clean install
Set "ONAP" configuration in Eclipse
To set the newly built checkstyle files in Eclipse:
- Preferences->Checkstyle
- Click "New"
- Select "External Configuration File"
- Give it a name eg ONAP
- Point at the file eg: /home/liam/git/onap/oparent/checkstyle/src/main/resources/onap-checkstyle/onap-java-style.xml
- Click OK
- Select "ONAP" configuration and click "Set as Default"
- 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:
- Select all the projects you want to apply the profile to in the Eclipse project explorer (not the one that you set up above)
- Right click->Checkstyle->Configure projects from blueprint
- Select the project you set up above
- Now all the projects have the correct checkstyle setup.
Sorry this was so long, how can something so simple be so complex!