diff --git a/documentation/eclipse.asciidoc b/documentation/eclipse.asciidoc index 1ed35db54..4fbd138d2 100644 --- a/documentation/eclipse.asciidoc +++ b/documentation/eclipse.asciidoc @@ -13,11 +13,39 @@ You may also supply additional arguments as `devon eclipse «args»`. These are [options="header"] |======================= |*Argument(s)* |*Meaning* -|`setup` |setup Eclipse (install and verify) -|`run` |launch Eclipse IDE (default if no argument is given) -|`start` |same as `run` -|`ws-up[date]` |update eclipse workspace -|`ws-re[verse]` |reverse merge changes from workspace into settings -|`ws-reverse-add`|reverse merge adding new properties -|`create-script` |create launch script for this IDE, your current workspace and your OS +|`setup` |setup Eclipse (install and verify) +|`add-plugin «id» [«url»]`|install an additional plugin +|`run` |launch Eclipse IDE (default if no argument is given) +|`start` |same as `run` +|`ws-up[date]` |update eclipse workspace +|`ws-re[verse]` |reverse merge changes from workspace into settings +|`ws-reverse-add` |reverse merge adding new properties +|`create-script` |create launch script for this IDE, your current workspace and your OS |======================= + +== plugins +During the link:setup.asciidoc[setup] `devon eclipse setup` will be called what automatically installs Eclipse. The project link:configuration.asciidoc[configuration] typically defines the plugins that will be installed via `ECLIPSE_PLUGINS` link:variables.asciidoc[variable]. Otherwise defaults from this `eclipse` link:cli.asciidoc#commandlets[commandlet] will apply. +However, for specific needs you may even install additional plugins. In general you should try to stick with the configuration pre-defined by your project. But some plugins may be considered as personal flavor and are typically not predefined by the project config. This e.g. applies for devstyle that allows a real dark mode for eclipse and tunes the theming and layout of Eclipse in general. To avoid that projects ship with +too many plugins that may waste resources but are not used by every developer you have the freedom to install some additional plugins. Be aware that this comes at your own risk and sometimes plugins can conflict and break your IDE. The following list of plugins is guaranteed to be supported by this commandlet: + +* https://github.com/devonfw/tools-cobigen/releases[cobigen] (incremental code-generator) +* http://andrei.gmxhome.de/eclipse/[anyedit] (for easy compare with clipboard, etc.) +* http://eclipse-cs.sf.net/update/[checkstyle] (for checkstyle support) +* https://spotbugs.github.io/eclipse/[spotbugs] (successor of findbugs) +* http://basti1302.github.com/startexplorer/update/[startexplorer] (for support to open current item in file manager of your OS) +* http://marketplace.eclipse.org/content/tm-terminal[terminal] (open terminal/shell inside Eclipse as view) +* http://download.eclipse.org/egit/github/updates/[github] (for devonfw projects that want to access github issues in Eclipse) +* http://www.soapui.org/eclipse/update/site.xml[soapui] (for service testing) +* http://regex-util.sourceforge.net/update/[regexutil] (to test regular expressions) +* https://m-m-m.github.io/eclipse-templatevariables/latest[templatevariables] (for advanced JDT templates) +* https://www.genuitec.com/updates/devstyle/ci/[devstyle] + +The link-titles are the IDs accepted by `devon eclipse add-plugin «id»`. Otherwise the full featureID has to be specified together with the URL of the update site. However this is intendet for project specific configuration. Here is an example how a project can configure the plugins in his `devon.properties` inside the link:settings.asciidoc[settings]: +``` +ECLIPSE_PLUGINS=("AnyEditTools.feature.group" "http://andrei.gmxhome.de/eclipse/" "com.ess.regexutil.feature.group" "http://regex-util.sourceforge.net/update/") +``` +For the above listed plugins you can also use the short form: +``` +ECLIPSE_PLUGINS=("anyedit" "" "regexutil" "") +``` +Of course you may also mix plugin IDs with fully qualified plugins. \ No newline at end of file diff --git a/documentation/integration.asciidoc b/documentation/integration.asciidoc new file mode 100644 index 000000000..a88b57420 --- /dev/null +++ b/documentation/integration.asciidoc @@ -0,0 +1,90 @@ += Integration + +The `devon-ide` already brings a lot of integration out of the box. This page is for users that want to get even more out of it. For instance this IDE ships with a `console` script to open a shell with the environment variables properly set for your `devon-ide` installation, so you get the correct version of your tools (Java, Maven, Yarn, etc.). However, you might want to open a shell from your IDE or your file manager. For some of these use-cases you need additional tweaks that are described on this page. + +== Windows +OASP4J-IDE ships with a script `IDEenv.bat` that checks if you are currently in a directory (CWD) that belongs to an `devon-ide` project. In that case the script will automatically set the environment variables for that projects. Otherwise the script will have no effect and do no harm. +Preparation: + +* Please copy `IDEenv.bat` from https://github.com/devonfw/devon-ide/tree/master/scripts/src/main/resources/system[system] folder into a central `scripts` folder (e.g. `C:\Users\«MyLogin»\scripts` or `C:\Program Files\scripts`) +* Ensure that this `scripts` directory is added to your system path: +** Got to `Computer > Properties > Advanced system settings > Environment Variables` +** In the upper group (`User variables for ...`) select the variable `PATH` +** Click on `Edit` +** To the end of the `Variable value` append a semicolon (`;`) followed by the absolute path of the `scripts` directory (e.g. append `;C:\Users\«MyLogin»\scripts`) +** Confirm with `OK` (3 times) + +=== CMD +If you want to open a `CMD` (MS Dos Shell) directly from `Windows Explorer` for a folder in your `devon-ide` project you will also want to have the environment variables set properly so that you can run `mvn`, `yarn`, `gulp`, or whatever directly from that shell. Therefore you once have to follow these steps: + +* Right-click on the file `IDEenv.reg` from https://github.com/devonfw/devon-ide/tree/master/scripts/src/main/resources/system[system] and choose `Merge` from Context-Menu. +* Confirm the dialog `User Account Control` with `Yes`. +* Confrim the dialog `Registry Editor` with `Yes`. +* Click `OK`. + +Now you have the option `Open CMD here` if you right click on a folder in `Windows Explorer` that will open `CMD` and automatically setup your environment according to the `devon-ide` project containing the folder (if any, see above). + +=== ConEMU +https://conemu.github.io/[ConEmu] is a great extension that brings additional features such as tabs to your windows shells. If you like it, you will also want to have it integrated with `devon-ide`. All you need to do is follow these simple steps: + +* Copy the file `CmdInit.cmd` from your ConEmu installation (`C:\Program Files\ConEmu\ConEmu\CmdInit.cmd`) to a personal folder (e.g. `C:\Users\MYLOGIN\scripts`). +* Modify this copy of `CmdInit.cmd` by adding the line `IDEenv` (e.g. at line 6) and saving. +* Go to `ConEmu` and open the `settings` (via context menu or `[Windows][Alt][p]`). +* Select `Startup > Tasks` from the left tree. +* Select the first option form `Predefined tasks (command groups)` (`{Shells::cmd}`) +* In the text area at the right bottom modify the location of `CmdInit.cmd` to your customized copy (`%HOME%\scripts\CmdInit.cmd`). +* Select `Integration` from the left tree. +* Click on the upper `Register` button (for `ConEmu Here`). +* Click on `Save settings` + +Now you have the option `ConEmu here` if you right click on a folder in `Windows Explorer` that will open a new tab in `ConEmu` and automatically setup your environment according to the `devon-ide` project containing the folder (if any, see above). + +=== ConEMU and StartExplorer + +You can even integrate the Eclipse StartExplorer plug-in and ConEMU to open up console right from the file tree of eclipse into ConEMU. You can do this by adding a custom command to StartExplorer: + +1. Open up eclipse +2. Open Window > Preferences +3. Select StartExplorer > Custom Commands on the left +4. Add on the right and setup the following command: `"C:\Program Files\ConEmu\ConEmu64.exe" -Dir ${resource_path} -runlist cmd.exe /k ""%ConEmuBaseDir%\CmdInit.cmd" & "IDEenv"" -cur_console:n` +Be aware that you potentially have to adapt the `ConEmu*.exe` path to match your installation. ++ +You can even add a shell login if you installed git bash on your machine. Please be aware to potentially adapt the `sh.exe` url to match your installation: `"C:\Program Files\ConEmu\ConEmu64.exe" -Dir ${resource_path} -runlist cmd.exe /k ""%ConEmuBaseDir%\CmdInit.cmd" & "IDEenv" & "%SYSTEMDRIVE%\Program Files\Git\bin\sh.exe" --login" -cur_console:n` +5. State two times the "Name for *" to your choice like "ConEMU" +6. OK -> OK +7. Right click on any folder/file in your eclipse file explorer and select StartExplorer > Custom Commands > ConEMU. +8. You will get a initialized console at the file/folder location! Have fun! + +=== Cygwin +Ensure to have `chere` installed in cygwin. Otherwise go the cygwin setup and install it. Then run a cygwin terminal as administrator and call this command: `chere -i -t mintty`. Now you will have the option `Bash Prompt Here` in your WindowsExplorer context menu. + +In order to integrate with `devon-ide` you simply add the line `. ~/IDEenv.sh` this to your `~/.bashrc`. +The `IDEenv.sh` shall be located in your unix home directory (`~/IDEenv.sh`) with this content: +[source,bash] +-------- +CWD=$PWD +while ! [ -e scripts/environment-project.sh ] && [ "$PWD" != "/" ] +do + cd .. +done +if [ -e scripts/environment-project.sh ] +then + . scripts/environment-project.sh +fi +cd $CWD +-------- + + +== Eclipse +You might want to open a terminal directly as view inside your Eclipse IDE. Therefore we provide link:eclipse.asciidoc[eclipse] with the http://marketplace.eclipse.org/content/tm-terminal[TM terminal] plugin. +Further the link:settings.asciidoc[settings] already configure that plugin so it automatically sets the environment properties correctly. In other words the integration comes out of the box. + +To use it all you need to do is to follow these steps: + +* Open the `Terminal` view (`Window > Show View > Other > Terminal > Terminal > OK`). +* Click on the `monitor icon` from the left of the icon bar of the `Terminal` view. +* Choose terminal (e.g. `Local Terminal`) and confirm with `OK` +* Execute `mvn -v` to verify your environment. + +== IntelliJ or WebStorm +You might want to open a terminal directly as view inside your IDEA IDE, that already ships with a feature for this out of the box. If you start your IDE via the `start-idea` script provided by `devon-ide` then everything is configured and your environment is set automatically. diff --git a/documentation/variables.asciidoc b/documentation/variables.asciidoc index 23468b373..d3ebaf5fa 100644 --- a/documentation/variables.asciidoc +++ b/documentation/variables.asciidoc @@ -22,7 +22,7 @@ Please note that we are trying to minimize any potential side-effect from `devon |*`MAVEN_HOME`*|`$DEVON_IDE_HOME/software/maven`|Path to Maven |*`MAVEN_OPTS`*|`-Xmx512m -Duser.home=$DEVON_IDE_HOME/conf`|Maven options |`ECLIPSE_VMARGS`|`-Xms128M -Xmx768M -XX:MaxPermSize=256M`|JVM options for Eclipse -|`ECLIPSE_PLUGINS`|`-`|Array with "update site URLs" and "feature groups" to cusomize required link:eclipse.asciidoc#plugins[eclipse plugins]. +|`ECLIPSE_PLUGINS`|`-`|Array with "feature groups" and "update site URLs" to cusomize required link:eclipse.asciidoc#plugins[eclipse plugins]. |`«TOOL»_VERSION`|`-`|The version of the tool `«TOOL»` to install and use (e.g. `ECLIPSE_VERSION` or `MAVEN_VERSION`). |`«TOOL»_BUILD_OPTS`|e.g.`clean install`|The arguments provided to the build-tool `«TOOL»` in order to run a build. |`«TOOL»_RELEASE_OPTS`|e.g.`clean deploy -Dchangelist= -Pdeploy`|The arguments provided to the build-tool `«TOOL»` in order to perform a release build. diff --git a/scripts/src/main/resources/scripts/command/eclipse b/scripts/src/main/resources/scripts/command/eclipse index c2360bf71..46c978dbb 100755 --- a/scripts/src/main/resources/scripts/command/eclipse +++ b/scripts/src/main/resources/scripts/command/eclipse @@ -51,26 +51,19 @@ function doSetup() { fi if [ -z "${ECLIPSE_PLUGINS}" ] then - # TODO CobiGen and TM-Terminal - # https://github.com/devonfw/devon-ide/issues/59 - # "com.devonfw.cobigen.eclipse.feature.feature.group,com.devonfw.cobigen.tempeng-freemarker,com.devonfw.cobigen.htmlplugin,com.devonfw.cobigen.javaplugin,com.devonfw.cobigen.jsonplugin,com.devonfw.cobigen.openapiplugin,com.devonfw.cobigen.propertyplugin,com.devonfw.cobigen.textmerger,com.devonfw.cobigen.tsplugin.com.devonfw.cobigen.tempeng-velocity,com.devonfw.cobigen.xmlplugin" - # "https://marketplace.eclipse.org/content/tm-terminal" "org.eclipse.tm.terminal.feature.feature.group,org.eclipse.tm.terminal.view.feature.feature.group,org.eclipse.tm.terminal.control.feature.feature.group,org.eclipse.tm.terminal.connector.ssh.feature.feature.group,org.eclipse.tm.terminal.connector.telnet.feature.feature.group" - # "http://downloads.sonarsource.com/eclipse/eclipse/" "org.sonar.ide.eclipse.feature.feature.group,org.sonar.ide.eclipse.jdt.feature.feature.group" - # "http://update.eclemma.org/" "org.eclipse.eclemma.feature.feature.group" - ECLIPSE_PLUGINS=( - "http://andrei.gmxhome.de/eclipse/" "AnyEditTools.feature.group" - "http://eclipse-cs.sf.net/update/" "net.sf.eclipsecs.feature.group" - "https://spotbugs.github.io/eclipse/" "com.github.spotbugs.plugin.eclipse.feature.group" - "http://basti1302.github.com/startexplorer/update/" "de.bastiankrol.startexplorer.feature.feature.group" - "http://regex-util.sourceforge.net/update/" "com.ess.regexutil.feature.group" - "https://m-m-m.github.io/eclipse-templatevariables/latest" "net.sf.mmm.eclipse.templatevariables.feature.feature.group" - "https://www.genuitec.com/updates/devstyle/ci/" "com.genuitec.eclipse.theming.feature.feature.group" - ) + doAddPlugin startexplorer + doAddPlugin regexutil + doAddPlugin templatevariables + doAddPlugin spotbugs + doAddPlugin checkstyle + doAddPlugin cobigen + doAddPlugin terminal + else + for ((i=0; i<${#ECLIPSE_PLUGINS[*]}; i=i+2)) + do + doAddPlugin "${ECLIPSE_PLUGINS[((${i}+1))]}" "${ECLIPSE_PLUGINS[${i}]}" + done fi - for ((i=0; i<${#ECLIPSE_PLUGINS[*]}; i=i+2)) - do - doInstallEclipsePlugin "${ECLIPSE_PLUGINS[${i}]}" "${ECLIPSE_PLUGINS[((${i}+1))]}" - done fi if [ -n "${1}" ] then @@ -107,6 +100,60 @@ function doConfigureEclipse() { fi } +# $1: id +# $2: optional URL +function doAddPlugin() { + if [ -z "${2}" ] + then + if [ "${1}" = "startexplorer" ] + then + doInstallEclipsePlugin "http://basti1302.github.com/startexplorer/update/" "de.bastiankrol.startexplorer.feature.feature.group" + elif [ "${1}" = "cobigen" ] + then + echo "***** ERROR *****" + echo "CobiGen still has no public update site - see https://github.com/devonfw/devon-ide/issues/84" + echo doInstallEclipsePlugin "https://github.com/devonfw/tools-cobigen/releases" "com.devonfw.cobigen.eclipse.feature.feature.group,com.devonfw.cobigen.tempeng-freemarker,com.devonfw.cobigen.htmlplugin,com.devonfw.cobigen.javaplugin,com.devonfw.cobigen.jsonplugin,com.devonfw.cobigen.openapiplugin,com.devonfw.cobigen.propertyplugin,com.devonfw.cobigen.textmerger,com.devonfw.cobigen.tsplugin.com.devonfw.cobigen.tempeng-velocity,com.devonfw.cobigen.xmlplugin" + elif [ "${1}" = "terminal" ] + then + echo "***** ERROR *****" + echo "TM Terminal does not have an update-site but only a marketplace site." + echo "We currently have no clue how to automatically install plugins from marketplace" + echo "Until this issue is resolved, you need to manually install TM Terminal from the below marketplace URL:" + echo http://marketplace.eclipse.org/content/tm-terminal + echo doInstallEclipsePlugin "https://TODO" "org.eclipse.tm.terminal.feature.feature.group,org.eclipse.tm.terminal.view.feature.feature.group,org.eclipse.tm.terminal.control.feature.feature.group,org.eclipse.tm.terminal.connector.ssh.feature.feature.group,org.eclipse.tm.terminal.connector.telnet.feature.feature.group" + elif [ "${1}" = "anyedit" ] + then + doInstallEclipsePlugin "http://andrei.gmxhome.de/eclipse/" "AnyEditTools.feature.group" + elif [ "${1}" = "regexutil" ] + then + doInstallEclipsePlugin "http://regex-util.sourceforge.net/update/" "com.ess.regexutil.feature.group" + elif [ "${1}" = "templatevariables" ] + then + doInstallEclipsePlugin "https://m-m-m.github.io/eclipse-templatevariables/latest" "net.sf.mmm.eclipse.templatevariables.feature.feature.group" + elif [ "${1}" = "spotbugs" ] + then + doInstallEclipsePlugin "https://spotbugs.github.io/eclipse/" "com.github.spotbugs.plugin.eclipse.feature.group" + elif [ "${1}" = "checkstyle" ] + then + doInstallEclipsePlugin "http://eclipse-cs.sf.net/update/" "net.sf.eclipsecs.feature.group" + elif [ "${1}" = "github" ] + then + doInstallEclipsePlugin "http://download.eclipse.org/egit/github/updates/" "org.eclipse.mylyn.github.feature.feature.group" + elif [ "${1}" = "devstyle" ] + then + doInstallEclipsePlugin "https://www.genuitec.com/updates/devstyle/ci/" "com.genuitec.eclipse.theming.feature.feature.group" + elif [ "${1}" = "soapui" ] + then + doInstallEclipsePlugin "http://www.soapui.org/eclipse/update/site.xml" "com.eviware.soapui.soapui_feature.feature.group" + else + echo "Undefined plugin ID ${1} - not known or supported." + echo "Provide full groupId together with URL of update-site." + fi + else + doInstallEclipsePlugin "${2}" "${1}" + fi +} + function doStartEclipse() { doConfigureEclipse echo "launching Eclipse..." @@ -119,12 +166,13 @@ then echo "Manage Eclipse IDE and workspace." echo echo "Arguments:" - echo " setup setup Eclipse (install and verify)" - echo " run | start launch Eclipse IDE (default if no argument is given)" - echo " ws-up[date] update eclipse workspace" - echo " ws-re[verse] reverse merge changes from workspace into settings" - echo " ws-reverse-add reverse merge adding new properties" - echo " create-script create eclipse-${WORKSPACE} script if not already exists" + echo " setup setup Eclipse (install and verify)" + echo " add-plugin «id» [«url»] install an additional plugin" + echo " run | start launch Eclipse IDE (default if no argument is given)" + echo " ws-up[date] update eclipse workspace" + echo " ws-re[verse] reverse merge changes from workspace into settings" + echo " ws-reverse-add reverse merge adding new properties" + echo " create-script create eclipse-${WORKSPACE} script if not already exists" exit fi ECLIPSE_HOME="${DEVON_IDE_HOME}/software/eclipse" @@ -155,6 +203,11 @@ do elif [ "${1}" = "create-script" ] then doCreateIdeScript eclipse + elif [ "${1}" = "add-plugin" ] + then + shift + doAddPlugin ${@} + exit ${?} else doFail "Unknown argument: ${1}" fi diff --git a/scripts/src/main/resources/scripts/command/vscode b/scripts/src/main/resources/scripts/command/vscode index 271bc67ff..b1d22fe64 100755 --- a/scripts/src/main/resources/scripts/command/vscode +++ b/scripts/src/main/resources/scripts/command/vscode @@ -21,6 +21,17 @@ function doSetup() { download_url="${download_url}/code-stable-1549938209.tar.gz" fi doInstall "${VSCODE_HOME}" "${download_url}" + if doIsMacOs + then + mkdir "${VSCODE_HOME}/bin" + echo -e "#!/usr/bin/env bash\n\"${VSCODE_HOME}/Visual Studio Code.app/Contents/MacOS/Electron\" \$@" > "${VSCODE_HOME}/bin/code" + chmod a+x "${VSCODE_HOME}/bin/code" + fi + echo "******* Notice *******" + echo "Installing plugins (extension-pack) into VS code..." + echo "Please wait until VSCode has successfully installed all plugins." + echo "You may then use or close VSCode as you like." + doRunCommand "'${VSCODE_HOME}/bin/code' --install-extension devonfw.devonfw-extension-pack &" fi } @@ -43,7 +54,7 @@ function doConfigureVsCode() { function doStartVsCode() { doConfigureVsCode echo "launching VSCode..." - code "${WORKSPACE_PATH}" + "${VSCODE_HOME}/bin/code" "${WORKSPACE_PATH}" } # CLI diff --git a/scripts/src/main/resources/scripts/devon b/scripts/src/main/resources/scripts/devon index de1a1262a..62ed1847c 100755 --- a/scripts/src/main/resources/scripts/devon +++ b/scripts/src/main/resources/scripts/devon @@ -17,6 +17,10 @@ do if [ -f "${PWD}/scripts/environment-project" ] && [ "${PWD: -27}" != "/scripts/src/main/resources" ] then source scripts/environment-project + if [ -z "${DEVON_IDE_HOME}" ] + then + export DEVON_IDE_HOME="${PWD}" + fi if [ -z "${1}" ] then echo "devon-ide has environment variables have been set for ${PWD}" @@ -128,7 +132,7 @@ then if [ -f ~/.devon/home ] then rm ~/.devon/home - fi + fi fi fi if [ -f "${DEVON_IDE_HOME}/scripts/command/${command}" ] diff --git a/scripts/src/main/resources/scripts/devon.bat b/scripts/src/main/resources/scripts/devon.bat index 97460848e..4868038a6 100644 --- a/scripts/src/main/resources/scripts/devon.bat +++ b/scripts/src/main/resources/scripts/devon.bat @@ -35,24 +35,20 @@ if not exist "%USERPROFILE%\scripts\devon.bat" ( if "%1%" == "" ( goto :setup_env ) -if exist "%ProgramFiles%\Git\bin\bash.exe" ( - set "BASH=%ProgramFiles%\Git\bin\bash.exe" - set "HOME=%USERPROFILE%" - goto :bash_detected -) -if exist "%ProgramFiles(x86)%\Git\bin\bash.exe" ( - set "BASH=%ProgramFiles(x86)%\Git\bin\bash.exe" + +for /F "usebackq tokens=2*" %%O in (`call "%SystemRoot%"\system32\reg.exe query "HKLM\Software\GitForWindows" /v "InstallPath" 2^>nul ^| "%SystemRoot%\system32\findstr.exe" REG_SZ`) do set GIT_HOME=%%P + +if exist "%GIT_HOME%\bin\bash.exe" ( + set "BASH=%GIT_HOME%\bin\bash.exe" set "HOME=%USERPROFILE%" goto :bash_detected ) -if exist "C:\cygwin64\bin\bash.exe" ( - set "BASH=C:\cygwin64\bin\bash.exe" - set "HOME=C:\cygwin64\home\%USERNAME%" - goto :bash_detected -) -if exist "C:\cygwin\bin\bash.exe" ( - set "BASH=C:\cygwin\bin\bash.exe" - set "HOME=C:\cygwin\home\%USERNAME%" + +for /F "usebackq tokens=2*" %%O in (`call "%SystemRoot%"\system32\reg.exe query "HKLM\Software\Cygwin\setup" /v "rootdir" 2^>nul ^| "%SystemRoot%\system32\findstr.exe" REG_SZ`) do set CYGWIN_HOME=%%P + +if exist "%CYGWIN_HOME%\bin\bash.exe" ( + set "BASH=%CYGWIN_HOME%\bin\bash.exe" + set "HOME=%CYGWIN_HOME%\home\%USERNAME%" goto :bash_detected ) echo: