Versions Compared

Key

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

...

Expand

The first issue is that the current ONAP master tagged version 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.

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.3 -b 1.2.3
  4. If you want CheckStyle to ignore generated files, do the following:
    1. Add the following tag to the above file:
      <module name="SuppressionFilter">
        <property name="file" value="<absolute path to the directory of the file>/suppressions.xml"/>
      </module>
    2. Create a file called "suppressions.xml" in the folder given above, and put the following content in it:
      <?xml version="1.0"?>
      <!DOCTYPE suppressions PUBLIC
        "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
        "https://checkstyle.org/dtds/suppressions_1_2.dtd">
      <suppressions>
        <suppress files="[\\/]generated-sources[\\/]" checks="[a-zA-Z0-9]*"/>
      </suppressions>
  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

Configure ONAP copyright for

...

Eclipse

Expand
  1. Window > Preferences
  2. Java > Code Style > Code Templates
  3. Click Code and select New Java files
  4. Click Edit
  5. Paste the license below
  6. Click Insert Variable and add the date
  7. Add the organization name
  8. Click Apply
No Format
============LICENSE_START=======================================================
 Copyright (C) $today.year <organization name>
 ================================================================================
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
  
 SPDX-License-Identifier: Apache-2.0
 ============LICENSE_END=========================================================


...

  1. Select, File, Settings, Tools, Checkstyle  
  2. Click on + beside the 'Configuration File' box to add a configuration
  3. Set description to something like 'ONAP Rules'
  4. Click on Browse to select the file <your_git_folder>/oparent/checkstyle/src/main/resources/onap-checkstyle/onap-java-style.xml  
    (assuming you have downloaded the oparent repo)
  5. Complete the Wizard (you can set exclusion properties if needed)
  6. Select the Configuration File you just added by selecting the relevant checkbox
  7. Click [OK] to close the settings popup

Configure ONAP copyright for IntelliJ

Expand
  1. File > Settings > Editor > Copyright > Copyright Profiles
  2. Click the + icon and add the copyright text below
  3. Change the organization name
  4. Go to the Copyright
  5. Select the new copyright profile from the drop down for Default project copyright
  6. Click Apply

============LICENSE_START=======================================================
 Copyright (C) $today.year <organization name>
 ================================================================================
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
  
 SPDX-License-Identifier: Apache-2.0
 ============LICENSE_END=========================================================


...