Skip to content

Latest commit

 

History

History
171 lines (109 loc) · 6.76 KB

File metadata and controls

171 lines (109 loc) · 6.76 KB

Preparation

Prerequisites

We try to make it as simple as possible for you. However, there are some minimal prerequisites:

  • You need to have a tool to extract *.tar.gz files (tar and gzip). On Windows lower Windows 10 (1803) use 7-zip. On all other platforms this comes out of the box.

  • You need to have git and curl installed.

    • On Windows all you need is download and install git for windows. This also ships with bash and curl. Please select the option to install Git Bash.

  • You need to have Postman installed.

Devon IDE

In this training we will use Devon IDE as integrated development environment. The original instruction how to setup it you can find here. Please perform following steps

Download

All releases of devonfw-ide can be downloaded from maven central. Please download the file devonfw-ide-scripts-2020.08.002.tar.gz

Install

Create a central folder like C:\projects. Inside this folder create a sub-folder for your new project such as jbf-training and extract the contents of the downloaded archive (devonfw-ide-scripts-*.tar.gz) into this new folder. Run the command setup in this folder (on windows just double click setup.bat). When asked, please select the default options.

devonfw-ide automatically integrates with Windows-Explorer during setup. If you need more options please refer to the integration documentation.

Devon CLI

The devonfw-ide is shipped with a central command devon. The setup will automatically register this command so it is available in any shell on your system. This page describes the Command Line Interface (CLI) of this command.

Devon

Without any arguments the devon command will determine your DEVON_IDE_HOME and setup your environment variables automatically. In case you are not inside of a devonfw-ide folder the command will echo a message and do nothing.

Please find more information here.

Please open a shell (CMD, ConEMU, PowerShell,…​) in the directory where you have installed devonfw-ide (e.g. C:\projects\jbf-training) and type

$ devon
devonfw-ide environment variables have been set for C:\projects\jbf-training in workspace main

$ echo %DEVON_IDE_HOME%
C:\projects\jbf-training

$ echo %JAVA_HOME%
C:\projects\jbf-training/software/java

$ mvn -v
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: C:\projects\jbf-training\software\maven\bin\..
Java version: 11.0.5, vendor: AdoptOpenJDK, runtime: C:\projects\jbf-training\software\java\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

The source code we are working on requires JDK 8. Please add following entry in conf\devon.properties file

export JAVA_VERSION=8u242b08

and type

$ devon java setup


$ echo %JAVA_HOME%
C:\projects\jbf-training/software/java

$ mvn -v
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: C:\projects\jbf-training\software\maven\bin\..
Java version: 1.8.0_242, vendor: AdoptOpenJDK, runtime: C:\projects\jbf-training\software\java\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Test the environment

To test the environment please generate a sample application, build it and run a sample application.

Generate a sample application

  • Please go to the workspaces\main directory in you devon-ide and generate a sample application (more info how to generate a Java application here)

$ cd workspaces\main\

$ devon java create com.example.domain.testapp -DarchetypeVersion=3.0.1

Next build the application

$ cd testapp

$ mvn clean install

You can try also

$ devon mvn

or

$ devon build

Run the sample application in IDE

devon-ide provides 3 IDE solutions

You will use in this training the Cobigen code generator which is integrated only with Eclipse. So please start ecliose using

$ devon eclipse

Now import our new project with File > Import. Select Maven/Existing Maven Projects

new app 5

Browse for the testapp directory. Next select the api and core projects.

new app 6 test

Click Finish and wait while the dependencies of the project are resolved to complete the import process.

Finally, using Spring Boot features (that provides us with an embedded Tomcat), we can run the app in an easy way. Look for the SpringBootApp.java class and click right button and use Run As > Java Application

If everything is ok you will see a messages in the Console window like

2020-11-12 10:23:07.755  INFO 40312 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2020-11-12 10:23:07.760  INFO 40312 --- [           main] c.example.domain.testapp.SpringBootApp   : Started SpringBootApp in 8.173 seconds (JVM running for 9.938)

The app will be available at http://localhost:8081/

login test
Note

You are redirected to the login screen because, by default, the new devon4j applications provide a basic security set up.

Please use the waiter/waiter credentials to login. You should see following content

welcome test