You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Installation of IntelliJ (IDEA Community Edition)

You can download IntelliJ IDEA directly from the JetBrains download page, or install JetBrains Toolbox, which makes it easy to upgrade.

Full development including Grouper project source code

Importing the Grouper project

1) Download the Git repository from GitHub.

If you just need the current source and not the full history, you can add --depth 1 -b GROUPER_2_5_BRANCH which will just get the last commit on the 2.5 branch, and be a smaller download

# $ git clone https://github.com/Internet2/grouper.git
#   OR
$ git clone --depth 1 -b GROUPER_2_5_BRANCH https://github.com/Internet2/grouper.git

Cloning into 'grouper'...
remote: Enumerating objects: 20992, done.
remote: Counting objects: 100% (20992/20992), done.
remote: Compressing objects: 100% (15795/15795), done.
remote: Total 20992 (delta 6768), reused 16398 (delta 4588), pack-reused 0
Receiving objects: 100% (20992/20992), 83.26 MiB | 2.83 MiB/s, done.
Resolving deltas: 100% (6768/6768), done.
Updating files: 100% (19449/19449), done.


2) Import as a Maven project in IDEA

(Projects → Open → Open File or Project → browse for .../grouper/grouper-parent/pom.xml → Open as Project → Trust and Open Maven Project → Trust Project


3) Wait a few minutes for it to download dependencies and index the project

This could take 10 minutes or more. While it's working, you won't see any project structure in the navigation pane. After it's don,e you will see all the main Grouper projects.



4) Set up language compatibility for Java 8

File → Project Structure → Project → Project SDK = Java 8


Setting up Debugging

1) Open wizard from menu Run → Edit Configurations

2) Add a new "Remote JVM Debug"


3) Name it "JPDA" or anything else, choose JDK 5-8, set port to 8000 (this is the Tomcat debug default, so helps to match it), use module classpath grouper.



How to debug

Once a process is listening on port 8000, you can start debugging the "JPDA" configuration

Tomcat

Start debugging with catalina jpda start. There won't be any output except in the logs, but it will start listening, and then you can debug. Stop Tomcat with catalina jpda stop.

GSH

Get the Java arguments by editing the configuration and copying the -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 argument in the command line pane. Then start gsh with:

GSH_JVMARGS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 ./gsh.sh

If you have something you want to breakpoint early in the startup, you can change suspend=n to suspend=y, which will wait for you to start debugging before starting GSH.

Container process

1) You need to enable port 8000 in your subimage for the port mapping to be available.

Dockerfile: EXPOSE 8000

2) Add these when running a container

-e GROUPER_EXTRA_CATALINA_OPTS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000'   -p 8000:8000


(optional) Build the jar file artifacts

1) On the right side of the app is a minimized Maven window. Click to expand it.

2) To builld all projects, select the Grouper (root) project, → Licfecycle → package , right click and select Run Maven Build

3) Progress will show in a terminal pane. When complete, all the jar files will be in their respective target/ subdirectories

(optional) Set up a scripts module for personal GSH scripts

You can create additional modules in Grouper that can live outside of the Grouper project. You can then create Groovy files that are aware of Grouper classes and can do type checking and context help.


1) Create the module

File → New → Module → Groovy

The default Module SDK should already be 1.8, and the Groovy library should be 2.5.0-beta-2

You can change the module name, and base location to anywhere, even outside of the Grouper project folder


2) Add dependencies

File → Project Structure → Modules → (or your module name)

In the Dependencies  tab, click on the Plus sign, add a Module dependency. Add two dependencies for grouper and grouperClient (and others if you wish)


3) Create a new script

The module will automatically create a src/ folder. Right click on it, select New Groovy Class (better is Groovy Script, but a bug in 2021.2 and 2021.3 cause this to fail).

If you choose New Groovy Class, you can delete the boilerplate class definition, and just write regular commands outside of a class. This should be aware of any grouper classes you reference



4) Run the script

There is probably a way to run this within the IDE, but I haven't tried it lately.




  • No labels