View on GitHub

winery

Eclipse Winery project

IntelliJ Configuration

Preparation: Install IntelliJ

  1. Get a JetBrains Ultimate License. For students: Visit https://www.jetbrains.com/student/.
  2. Install JetBrains Toolbox: choco install jetbrainstoolbox and choco pin add -n jetbrainstoolbox, because JetBrains does an auto update
  3. Install “IntelliJ IDEA Ultimate” using the JetBrains Toolbox.

Preparation of the code

Generate a war to have all dependencies fetched by maven: mvn package -DskipTests. This ensures that Version.java is generated and all node dependencies are fetched. If this goes wrong at the first run, execute mvn package -DskipTests a second time.

Setup of IntelliJ

  1. At start of IntelliJ, browse to the root pom.xml and open it as project.
  2. Enable checkstyle: Follow the shown steps and apply them in IntelliJ Enable CheckStyle in IntelliJ
    • Install the IntelliJ Checkstyle Plugin. It can be found via plug-in repository (Settings -> Plugins -> Browse repositories)
    • Open the Settings (by pressing Ctrl + Alt + S)
    • Go to Other Settings -> CheckStyle.
    • Click on the green plus and add checkstyle.xml from the root of the Winery code repository.
  3. Configure the code style (Source: https://youtrack.jetbrains.com/issue/IDEA-61520#comment=27-1292600)
    1. Open the Settings (by pressing Ctrl + Alt + S)
    2. Go to “Editor > Code Style”
    3. Click “Manage…” (right of “Scheme:”)
    4. Click “Import Scheme”
    5. Choose “IntelliJ IDEA code style XML”
    6. Navigate to intellij-idea-code-style.xml. It is located in docs/dev/config/IntelliJ IDEA
    7. Press “OK”
    8. You will see a message “Winery configuration settings were imported”.
    9. Press “OK”
    10. Press “Close”
    11. Press “OK”
  4. Setup code headers to be inserted automatically
    1. Open the Settings (by pressing Ctrl + Alt + S)
    2. Go to Editor > Copyright > Copyright Profiles
    3. Click the green plus
    4. Name “Winery”
    5. Copyright text from CodeHeaders
    6. Go to Editor > Copyright > Formatting
    7. Adjust copyright formatting settings
      • Change to Use block comments with Prefix each line
      • Set Relative Location to Before other comments
      • Increase Separator before/after Length to 81
      • GitAutoCheck
    8. Go to Editor > Copyright
    9. Set “Winery” as Default project copyright
    10. Press “OK”
  5. Configure Non-Null annotations properly
    This is required for the IntelliJ code inspections to run properly.
    1. Open the Settings (by pressing Ctrl + Alt + S)
    2. Search for “null”
    3. Go to “Build, Execution, Deployment”
    4. Go to “Compiler”
    5. Click on “Configure annotations…”
    6. At “Nullable annotations”, click on the plus
    7. Search for org.eclipse.jdt.annotation.Nullable
    8. Double click it
    9. At “NotNull annotations”, click on the plus.
    10. Search for org.eclipse.jdt.annotation.NonNull
    11. Double click it
    12. Click OK
    13. Click OK
  6. Setup Apache Tomcat
    1. Download Tomcat 9.0 from https://tomcat.apache.org/download-90.cgi. Choose “zip” (E.g., http://mirror.synyx.de/apache/tomcat/tomcat-9/v9.0.7/bin/apache-tomcat-9.0.7.zip).
    2. Extract it to C:\Apache. Result: C:\Apache\apache-tomcat-9.0.7.
    3. Press OK
    4. Set name and no browser launch:
    5. Add deployment artifacts:
    6. Set /winery as application context:
    7. Click “Apply”
  7. Setup npm run for Repository UI
  8. Setup npm run for Topology modeler
  9. Setup npm run for BPMN4TOSCA modeler
    1. Choose package.json of “org.eclipse.winery.workflowmodeler”
    2. Use ng as script
    3. Use serve as arguments
  10. Setup XSD validation for TOSCA files
    1. Open the Settings (by pressing Ctrl + Alt + S)
    2. Go to “Languages & Frameworks”
    3. Select “Schemas and DTDs”
    4. Click on the plus on the right at “External Schemas and DTDs”
    5. Enter http://docs.oasis-open.org/tosca/ns/2011/12 as URI
    6. In “Project Schemas” search for TOSCA-v1.0.xsd. It should be located at “org.eclipse.winery.common”.
      In the case of opening C:\winery-repository in IntelliJ, you have to select enter C:\git-repositories\winery\org.eclipse.winery.common\src\main\resources\TOSCA-v1.0.xsd in the Field “File”
    7. Click “OK”.
    8. Go to “Editor”
    9. Select “File Types”
    10. At “Recognized File Types”, scroll down to XML
    11. Select “XML”
    12. At “Registered Patterns”, click on the Plus
    13. Enter *.tosca in the popup.
    14. Click “OK”
    15. Click “OK”
  11. Optional: In case you do not want to have the live-update of Angular, you build the wars of the UI and then deploy as follows:
    • External artifact .../org.eclipse.winery.repository.ui/target/winery-ui.war to /
    • External artifact .../org.eclipse.winery.workflowmodeler/target/winery-workflowmodeler.war to /winery-workflowmodeler
  12. Get a JetBrains account and vote up following issues (at the right side, just click the thumbs-up next to “Voters”. In case you don’t see “Voters”, reload the page):
  13. Pros: Install the Key Promoter X plugin.
  14. Run everything
    • Select “Winery - REST”. Click on “Play” (the green rectangle)
    • Select “Repository UI”. Click on “Play”
    • Select “Topolgoy Modeler”. Click on “Play”.
    • Open “http://localhost:4200” in your browser.
  15. Demonstration: Open winery-repository (AKA tosca-definitions) in IntelliJ
    This ensures that you can work with the TOSCA files using the IDE.
    1. Go to File -> Open…
    2. Enter C:\winery-repository
    3. Click “OK”
    4. At the dialog “Open Project” choose “New Window”
    5. Expand winery-repository (on the left side)
    6. Expand nodetypes
    7. Exapnd http%3A%2F%2Fplain.winery.opentosca.org%2Fnodetypes
    8. Expand NodeTypeWithTwoKVProperties
    9. Double click NodeType.tosca
    10. Go to line 14
    11. Type in <
    12. See that <tosca:CapabilityDefinitions and other tosca elements are proposed
    13. No further action required. You can close the window.

Further Remarks

License

Copyright (c) 2017-2018 Contributors to the Eclipse Foundation

See the NOTICE file(s) distributed with this work for additional information regarding copyright ownership.

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 which is available at https://www.apache.org/licenses/LICENSE-2.0.

SPDX-License-Identifier: EPL-2.0 OR Apache-2.0