Difference between revisions of "IDE setup"

From Freeplane - free mind mapping and knowledge management software
(Pre-requisites)
m (IDE: Eclipse)
 
(26 intermediate revisions by 6 users not shown)
Line 1: Line 1:
=Pre-requisites=
+
==Prerequisites==
==Java Version==
 
  
You need to install a JDK (Java Development Kit). The usual JRE needed to run and use Freeplane is not sufficent to make developments on Freeplane.
+
Freeplane's build system is based on GRADLE. So gradle can support concerning development processing and generation of configuration files.
On Windows and Linux you can use Java Version 6 or later, on MacOS Java 7 or later is required.
 
  
==Eclipse package==
+
Freeplane can be developed in basically any IDE (integrated development environment) like '''Eclipse''', '''IntelliJ''' and '''Netbeans'''. These IDEs provide the UI (user interface) for the whole development process, including the support for code edit, search, debugging, testing,... At the same time, no developer is forced to use any of these IDEs, but can also use e.g. '''vim''', as gradle is able to provides fitting configurations for any environment. If you use a proper IDE, configuration and manifest files are needed e.g. for debugging. They are created when executing <code>gradle</code> with the <code>build</code> parameter set.
  
Like Freeplane, Eclipse is based on an OSGI kernel. For this reason Eclipse provides very good support for developing OSGI applications:
+
If you executed gradle builds for previous Freeplane versions, you should manually delete all <code>MANIFEST.MF</code> files which were generated by build scripts, they are not needed any more.
  
* All Bundle properties can be managed via the project properties.
 
* One launch configuration for eclipse in the Freeplane sources, <tt>freeplane_devresources/eclipse/freeplane-osgi.launch</tt>, uses Eclipse' standard OSGI implementation.
 
  
:''Note:'' Unlike in the "real application" it's necessary to list all plugins to load in the launch configuration. In the regularly deployed application all plugins in the <tt>plugin</tt> subdirectory are loaded. (By the way also the user's Freeplane directory is scanned for plugins in a <tt>plugin</tt> directory if this exists.)
+
==IDE: Eclipse==
  
:Therefore you need an eclipse version with Plug-in Development Environment (PDE), for example [http://www.eclipse.org/downloads/ Eclipse for RCP and RAP Developers]
+
Eclipse can directly import Gradle files using the <code>buildship</code> plugin. Please see [[Scripting environment setup#How to set up your environment with the Eclipse Plug-ins for Gradle|the setup for scripting]], with the difference that you can use your ''freeplane'' local repository directory in stead of the ''freeplane_root'' source directory. There is no need to use the Gradle <code>cleanEclipse eclipse</code> tasks that are explained in the next paragraph. If you do, it will remove the Gradle nature from the imported Freeplane projects.
  
==Getting Started Working with Freeplane Within the Eclipse IDE==
+
Alternatively, if you want to configure Eclipse manually, all necessary eclipse project files can be generated by gradle using the <code>eclipse</code> parameter together with the <code>gradle</code> command. In effect, you should start a full and clean build using the following command:
  
===Setup===
+
<pre>gradle clean build cleanEclipse eclipse</pre>
* Make sure you have a copy of the Freeplane code - see the [[Git howto|Git How To]] for more information.
 
* Grab a copy of the newest version of Eclipse from the [http://www.eclipse.org/downloads Eclipse download page]. You need an eclipse version with Plug-in Development Environment (PDE), for example "Eclipse for RCP and RAP Developers".
 
:If you are running on GNU/Linux, you may need to install the packages "eclipse-pde" (or something like that) and "eclipse-egit".
 
* Specify a path to your JDK in eclipse.ini setting -vm option as described at http://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM
 
* Start up Eclipse - It should prompt you for a workspace (this is an area where your projects will be stored). Have this where you set up your git home directory.
 
  
===Importing The Projects===
+
This also creates an executable Freeplane application within the <code>BIN</code> folder below the current folder.
Before we can start working with Freeplane we have to "import" it as a new project:
 
* Goto : File -> Import...
 
* Under "General" -> Existing Projects into Workspace
 
* Select root directory should point to the git working directory. At this point a project list should appear.
 
:''Note:'' If you are not developing for Apple Mac you can deselect the freeplane_mac project.
 
* Choose Finish. The projects should be added and the workspace will automatically "build".
 
  
''Note'': If at this point it complains about <tt>freeplane_ant</tt> this can also be removed as Eclipse does not ship with the correct ant version.
+
Now, you should start your Eclipse IDE and let it point to the base project folder (the folder where you just executed <code>gradle</code>). Up and running, you would now import the Freeplane project from the Eclipse top menu and choose ALL Freeplane project options from the import list. Now, please drop the '''freeplane_mac''' project when you don't work on a Mac. Otherwise it would cause you problems.
  
===Compiling required jar files===
+
If you want to build and launch Freeplane for the first time in your newly configured IDE, you should look for the location of the launch configurations within Freeplane's source tree on the left side of the Eclipse window:
Before the first run some auxiliary jar files should be compiled
 
* Run ant build in directory freeplane_framework/ant with target "build"
 
* Refresh all projects
 
  
===Launching the Project===
+
<pre>freeplane_debughelper / eclipse / freeplane.launch</pre>
Now that The project has been imported we need to set up the launcher:
 
* Goto : Run -> Run Configurations
 
* Locate the OSGi Framework entry.
 
:If this entry is not there, the required Plug-in Development Environment (PDE) is missing, see above.
 
* Duplicate configuration freeplane-osgi. Give the new configuration name freeplane-osgi local
 
* Select Tab "Common" and select "save as local file"
 
* Under Mac-OS also select tab "Arguments" and add VM argument "-Xdock:name=Freeplane"
 
* Upon clicking "Run" Freeplane should appear.
 
  
You are now ready for development/debugging within Eclipse.
+
would be the most useful one. But there are others like <code>freeplane_debughelper/eclipse/freeplane dist.launch</code> and <code>freeplane_debughelper/eclipse/freeplane dist mac.launch</code>, which are used to launch binary distributions created by gradle build.  
  
==Settings==
+
As soon as you have once launched Freeplane as described, you will find appropriate menu items within the icons menu (RUN as well as DEBUG), from where you now can launch Freeplane for RUN or DEBUGGING purposes.
In project <tt>freeplane_devresources</tt> you find  
 
* some launch configurations for starting the application
 
* eclipse code-templates, formatter and clean-up configuration files which must be used if you contribute your code to the project.
 
  
==Version control integration==
+
==IDE: IntelliJ==
You can use eclipse git plugin EGit. Look at [[Git howto]] for more information.
 
  
==Useful Eclipse plugins==
+
The short story:<br/>
* For properties files, especially for language resources, the [http://propedit.sourceforge.jp/index_en.html Properties Editor plugin] is useful. You can install the Properties Editor plugin directly within Eclipse by [http://propedit.sourceforge.jp/howto_eclipseplugin_install_en.html following these short steps].
+
IntelliJ can directly import gradle files. After the import the directory
 +
<code>freeplane_debughelper/idea/runConfigurations</code> containing run
 +
configuration files should be copied into directory <code>.idea</code>
 +
created by IntelliJ in project root. Restart IntelliJ afterwards.
  
==Git Eclipse: troubleshooting==
+
Detailed instructions:
There are 2 commons problems you can be faced to when using Git in Eclipse. Here are the solutions.
+
=== Download and install IntelliJ [Community Edition] ===
* '''At Eclipse startup''' if Eclipse displays a warning message "'''EGIT could not defined where git is installed'''", open Eclipse then go to Windows > Preferences > Team > Git > Configuration > Tab 'System Settings' and here in 'Location' you can indicate your Git installation folder. See the following page to [http://freeplane.sourceforge.net/wiki/index.php/Git_howto#Installation_.2F_Configuration install and use Git in Freeplane project].
+
* https://www.jetbrains.com/idea/download
* '''When, in Eclipse, you are running the build.xml''' stored in Freeplane_framework, you receive the following error message "'''[exec] Execute failed: java.io.IOException: Cannot run program "git" (in directory "[Directory]"): CreateProcess error=2, The system cannot find the file specified'''" resulting in a build failed. Then follow these steps in Eclipse: go to Run > External Tools > External Tools Configurations.... Then select the ant file you want to run. Then select the tab 'Environment' and click the 'New...' button to add a new variable. This new variable name should be set to PATH and the value should be the folder where Git is installed, for instance D:\AppsJavaDev\Git\bin.
+
* Extract in some directory
 +
* Run .../idea-IC-VERSION/bin/idea.sh (or similar on non-GNU platforms)
 +
 
 +
** Do not import settings
 +
** Choose (any) UI theme
 +
** (optionally) Create desktop entry
 +
** (optionally) Create launcher script
 +
** Choose default plugins (you can disable some, like Android)
 +
** Do not download featured plugins
 +
** Click ''Start using IntelliJ IDEA''
 +
 
 +
=== Open the freeplane checkout (IntelliJ 2021) ===
 +
* Click ''Open'' (when starting IntelliJ)
 +
* Point to the ''build.gradle'' in the checkout and click ''OK'', then ''Open as Project''
 +
* Trust project
 +
* change the project:
 +
** Enable ''Build with IntelliJ''
 +
** You will get an error due to a proected package sun.awtshell -> <br>File->Settings->Build->Compiler->Java Compiler->[ ] use Release
 +
* execute a toplevel gradle build for the command line (this is necessary for generating lexers etc.)
 +
* copy <code>freeplane_debughelper/idea/runConfigurations</code> (the whole <code>runConfigurations</code> directory!) containing run configuration files into <code>.idea</code> created by IntelliJ in project root
 +
* Restart IntelliJ afterwards.
 +
 
 +
=== Import the Freeplane build system (IntelliJ <= 2020) ===
 +
* Click ''Import Project'' (when starting IntelliJ)
 +
* Point to the ''settings.gradle'' in your checkout and click ''OK''
 +
** Choose settings like these:<br/>[[File:IntelliJ_import_gradle.png]]
 +
** Make sure to use an unzipped gradle binary distribution (~/Downloads/gradle-5.1.1 in this case); a gradle linux distribution package did not work for me, not even with [https://stackoverflow.com/questions/18495474/how-to-define-gradles-home-in-idea this information]
 +
* Click ''OK'' and wait
 +
* copy <code>freeplane_debughelper/idea/runConfigurations</code> (the whole <code>runConfigurations</code> directory!) containing run configuration files into <code>.idea</code> created by IntelliJ in project root
 +
* Restart IntelliJ afterwards.
 +
 
 +
=== Start developing Freeplane ===
 +
* In order to run, choose ''Run->Run...->freeplane''
 +
** If the field "Use classpath for module" is empty, put '''freeplane_root.freeplane_debughelper.main''' in there
 +
* In order to debug, choose ''Run->Debug...->freeplane''
 +
 
 +
==IDE: Netbeans==
 +
 
 +
Netbeans can directly import gradle files using its Gradle support plug-in.
 +
Gradle tasks needed for running and debugging from the IDE are defined in <code>freeplane_debughelper/build.gradle</code> 
  
 
[[Category:Coding]]
 
[[Category:Coding]]

Latest revision as of 20:31, 4 September 2021

Prerequisites

Freeplane's build system is based on GRADLE. So gradle can support concerning development processing and generation of configuration files.

Freeplane can be developed in basically any IDE (integrated development environment) like Eclipse, IntelliJ and Netbeans. These IDEs provide the UI (user interface) for the whole development process, including the support for code edit, search, debugging, testing,... At the same time, no developer is forced to use any of these IDEs, but can also use e.g. vim, as gradle is able to provides fitting configurations for any environment. If you use a proper IDE, configuration and manifest files are needed e.g. for debugging. They are created when executing gradle with the build parameter set.

If you executed gradle builds for previous Freeplane versions, you should manually delete all MANIFEST.MF files which were generated by build scripts, they are not needed any more.


IDE: Eclipse

Eclipse can directly import Gradle files using the buildship plugin. Please see the setup for scripting, with the difference that you can use your freeplane local repository directory in stead of the freeplane_root source directory. There is no need to use the Gradle cleanEclipse eclipse tasks that are explained in the next paragraph. If you do, it will remove the Gradle nature from the imported Freeplane projects.

Alternatively, if you want to configure Eclipse manually, all necessary eclipse project files can be generated by gradle using the eclipse parameter together with the gradle command. In effect, you should start a full and clean build using the following command:

gradle clean build cleanEclipse eclipse

This also creates an executable Freeplane application within the BIN folder below the current folder.

Now, you should start your Eclipse IDE and let it point to the base project folder (the folder where you just executed gradle). Up and running, you would now import the Freeplane project from the Eclipse top menu and choose ALL Freeplane project options from the import list. Now, please drop the freeplane_mac project when you don't work on a Mac. Otherwise it would cause you problems.

If you want to build and launch Freeplane for the first time in your newly configured IDE, you should look for the location of the launch configurations within Freeplane's source tree on the left side of the Eclipse window:

freeplane_debughelper / eclipse / freeplane.launch

would be the most useful one. But there are others like freeplane_debughelper/eclipse/freeplane dist.launch and freeplane_debughelper/eclipse/freeplane dist mac.launch, which are used to launch binary distributions created by gradle build.

As soon as you have once launched Freeplane as described, you will find appropriate menu items within the icons menu (RUN as well as DEBUG), from where you now can launch Freeplane for RUN or DEBUGGING purposes.

IDE: IntelliJ

The short story:
IntelliJ can directly import gradle files. After the import the directory freeplane_debughelper/idea/runConfigurations containing run configuration files should be copied into directory .idea created by IntelliJ in project root. Restart IntelliJ afterwards.

Detailed instructions:

Download and install IntelliJ [Community Edition]

    • Do not import settings
    • Choose (any) UI theme
    • (optionally) Create desktop entry
    • (optionally) Create launcher script
    • Choose default plugins (you can disable some, like Android)
    • Do not download featured plugins
    • Click Start using IntelliJ IDEA

Open the freeplane checkout (IntelliJ 2021)

  • Click Open (when starting IntelliJ)
  • Point to the build.gradle in the checkout and click OK, then Open as Project
  • Trust project
  • change the project:
    • Enable Build with IntelliJ
    • You will get an error due to a proected package sun.awtshell ->
      File->Settings->Build->Compiler->Java Compiler->[ ] use Release
  • execute a toplevel gradle build for the command line (this is necessary for generating lexers etc.)
  • copy freeplane_debughelper/idea/runConfigurations (the whole runConfigurations directory!) containing run configuration files into .idea created by IntelliJ in project root
  • Restart IntelliJ afterwards.

Import the Freeplane build system (IntelliJ <= 2020)

  • Click Import Project (when starting IntelliJ)
  • Point to the settings.gradle in your checkout and click OK
    • Choose settings like these:
      IntelliJ import gradle.png
    • Make sure to use an unzipped gradle binary distribution (~/Downloads/gradle-5.1.1 in this case); a gradle linux distribution package did not work for me, not even with this information
  • Click OK and wait
  • copy freeplane_debughelper/idea/runConfigurations (the whole runConfigurations directory!) containing run configuration files into .idea created by IntelliJ in project root
  • Restart IntelliJ afterwards.

Start developing Freeplane

  • In order to run, choose Run->Run...->freeplane
    • If the field "Use classpath for module" is empty, put freeplane_root.freeplane_debughelper.main in there
  • In order to debug, choose Run->Debug...->freeplane

IDE: Netbeans

Netbeans can directly import gradle files using its Gradle support plug-in. Gradle tasks needed for running and debugging from the IDE are defined in freeplane_debughelper/build.gradle