欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Run Scheduler with Intellij Idea

程序员文章站 2022-03-02 22:47:13
...

Preparation

  • Intellij Idea ULTIMATE (mine is 17.02)
  • Plugins
    • Lombok
    • Save Actions

Build project

After download hue-scheduler with git clone. Run "mvn package" to build the project.

Open Idea

Need to pre set some environment variables, so we can write script according to eclipse.sh.
I share mine.

#!/bin/bash

SET_ENV_DIR=$WORK_SPACE_DIR/set-env.sh

if [ -f $SET_ENV_DIR ]
then
    source $SET_ENV_DIR
    `/opt/idea-IU-172.3317.76/bin/idea.sh` >& /dev/null &
else
    echo "no source file in ${WORK_SPACE_DIR}"
fi

Import projects

  1. Select New -> Project from Existing Sources -> Select hue-scheduler
  2. Select Import project from external model -> Maven -> Press Next
  3. Enable check box Search for projects recursively, and enable check box Import Maven projects automatically -> Press Next
  4. Press Next util Finish

Config server

  1. Add Tomcat application server
    1. Open Settings dialog: From menu bar, File -> Settings...
    2. Open Application Servers setting: Build, Execution, Deployment -> Application Servers
    3. Add Tomcat: Click the top-leftmost + symbel -> Select your Tomcat install path -> Click OK
    4. Apply settings: Click Apply -> Click OK
  2. Create Tomcat server
    1. Open Run Configurations: From menu bar, Run -> Edit configurations
    2. Add local Tomcat server: Click the top-leftmost + symbel -> Tomcat Server -> Local -> A local Tomcat server created
  3. Config Tomcat
    1. VM options: Select a local Tomcat server -> config VM options from Server tag.
    2. Deployment setting: Select Deployment tag -> click the + symbel -> Artifact-> Select the hue-scheduler-front:war exploded artifact to deploy
    3. Config application context: input /hue-scheduler-front
    4. Apply configurations: Click Apply -> Click OK
  4. Config Project Structure
    1. Wipe out some incorrect content root: Open Project Structure -> Click hue-scheduler-front -> Select Sources tag -> Wipe out Wrong Content Root
    2. Wipe out some unnecessary modules: Open Project Structure -> Delete hue-scheduler-front-aggregator and hue-scheduler-client-lib. (Actually, what we need is hue-scheduler-client-lib-server-side that will be added next).
    3. Now, You can boot Server for test.

Config class path and deployment assembly

  1. Import project hue-scheduler-client-lib, it will be shown as hue-scheduler-client-lib-aggregator
  2. Select module hue-scheduler-front, and open module setting dialog.
  3. Select Dependencies tag, remove hue-scheduler-client-lib-server-side library file, and add imported hue-scheduler-client-lib-server-side module
  4. Select Artifacts from left panel, and select hue-scheduler-front:war exploded, and select Output Layout
    1. Select WEB-INF -> lib -> Remove hue-scheduler-client-lib library file
    2. Select WEB-INF -> classes -> + -> Module Output -> Choose hue-scheduler-client-lib-server- side
  5. Apply configurations: Click Apply -> Click OK