Andrey Hihlovskiy
Professional blog on groovy, gradle, Java, Javascript and other stuff.
Category Archives: github
Powerful feature in Gretty 0.0.24 – full support of Spring Boot 1.1.0
June 11, 2014
Posted by on Today is a wonderful day: Spring Boot 1.1.0 was released and I released Gretty version 0.0.24.
Gretty is a feature-rich gradle plugin for running web-apps on Jetty. It supports multiple Jetty versions (7, 8 and 9), multiple web-apps and many more. It wraps Jetty functions as convenient Gradle tasks and configuration DSL. A complete list of Gretty features is available in feature overview.
There is new powerful feature in Gretty 0.0.24: it supports running Spring Boot web-apps out-of-the-box. All Gretty features, including (but not limited to) debugging, code coverage and integration tests, also apply to spring-boot web-apps.
Simplest Gretty setup with Spring Boot:
buildscript { | |
ext { | |
springBootVersion = '1.1.0.RELEASE' | |
} | |
repositories { | |
mavenLocal() | |
jcenter() | |
} | |
dependencies { | |
classpath "org.springframework.boot:spring-boot-loader-tools:${springBootVersion}" | |
classpath "org.springframework.boot:spring-boot-dependency-tools:${springBootVersion}" | |
classpath 'org.akhikhl.gretty:gretty-spring-boot-plugin:0.0.24' | |
} | |
} | |
apply plugin: 'java' | |
apply plugin: 'gretty-spring-boot' |
You get Gretty as maven artifacts at jcenter and maven central under the group “org.akhikhl.gretty”.
Full Gretty sources and examples are available at https://github.com/akhikhl/gretty
Full Gretty documentation is available at http://akhikhl.github.io/gretty-doc/
Killer feature in Gretty version 0.0.18 – multiple web-apps support
May 22, 2014
Posted by on Let’s assume, you are developing web-applications with JVM-based languages and technologies and are looking for the solution of the following problem:
You have a bunch of web-apps, that must run all at the same time, because they call each other. You also want to debug multiple web-apps and even run integration tests – on the complete bunch.
Here is the solution to this problem: use Gretty. This is gradle plugin, capable of exactly this: running multiple web-apps, debugging, integration tests. Of course, it is open-source and available at jcenter and maven central.
Gretty can start arbitrary number of web-apps of various types: gradle projects, WAR-files in the file system and even WAR-files from maven dependencies.
Multiple web-apps feature works out-of-the-box in configureless mode, although it is fully configurable/customizable.
The central concept of Multiple web-apps feature is farm – a collection of web-apps, that should run together.
There are two ways to define and use farms:
- Default farm is automatically created for you by Gretty. You may add artbitrary web-apps to it and then invoke farm-specific tasks: farmRun, farmRunDebug, etc. Note that farm-specific tasks are not using gretty tasks (jettyRun, jettyRunDebug, etc.), but they understand and use gretty configurations.
- Named farms, which you create yourself in gradle script. You can add as many named farms as you want, and you can add web-apps to farms in arbitrary constellations. Each named farm provides a specific set of farm tasks. For example, if you define farm with name “XYZ”, there will be new tasks farmRunXYZ, farmRunDebugXYZ, etc. available.
You can start using multiple web-apps support right away, using the following scenario as a starting point:
Create three empty folders: ProjectA, ProjectB and ProjectC, so that folder tree looks like this:
ProjectA |-- ProjectB \-- ProjectC
Create file “ProjectA/settings.gradle”, insert code:
include 'ProjectA', 'ProjectB'
Explanation: we organize multi-project setup, so that multiple web-apps can be started/stopped by gretty-farm plugin.
Create file “ProjectA/build.gradle”, insert code:
buildscript { repositories { jcenter() } dependencies { classpath 'org.akhikhl.gretty:gretty-plugin:+' } } apply plugin: 'gretty-farm'
Create file “ProjectA/ProjectB/build.gradle”, insert code:
apply plugin: 'gretty'
Create file “ProjectA/ProjectC/build.gradle”, insert code:
apply plugin: 'gretty'
Done! Now you can run multiple web-apps by running the following command in ProjectA:
gradle farmRun
Expected output:
Jetty server 9.1.0.v20131115 started. :ProjectB runs at the address http://localhost:8080/ProjectB :ProjectC runs at the address http://localhost:8080/ProjectC servicePort: 9900, statusPort: 9901 Press any key to stop the jetty server.
Of course, you’ll get 404 in the browser, because web-apps don’t contain any pages. But, as soon as you add pages or/and servlets to the web-apps, things will get real.
By default farm automatically adds all subprojects of the farm project, which are facilitated with gretty plugin, to web-apps list. You can also explicitly add web-apps to the given farm.
Gretty-farm plugin defines new, distinct set of tasks for running farms: farmRun, farmRunDebug, farmRunWar, farmRunWarDebug, etc.
How to install and use Gollum on vanilla Debian/Ubuntu/Mint machine
May 19, 2014
Posted by on Suppose you have a vanilla Debian/Ubuntu/Mint machine and you want to use Gollum – wiki system, built on top of Git and used internally by Gihub wiki pages. Here are the necessary steps:
- Install required components from OS repositories:
sudo apt-get install ruby ruby-dev libz-dev libicu-dev build-essential
-
Install Gollum from gems repository:
sudo gem install gollum
-
Create test git repository and run Gollum on it:
mkdir testwiki cd testwiki git init gollum
Check: you should see messages like this:
user@host:~/Projects/testwiki$gollum [2014-05-19 18:58:02] INFO WEBrick 1.3.1 [2014-05-19 18:58:02] INFO ruby 1.9.3 (2012-04-20) [x86_64-linux] == Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick [2014-05-19 18:58:02] INFO WEBrick::HTTPServer#start: pid=27319 port=4567
that means: Gollum is up and running on port 4567.
Now you can launch you favourite browser, enter addresss http://localhost:4567 and start editing wiki pages:
Whenever you save a page, Gollum commits it to git repository. Optionally you can add a message to commit.
It is worth noting, that Gollum supports many important markup languages: AsciiDoc, Creole, Markdown, MediaWiki, Org-mode, Pod, RDoc, reStructuredText, Textile.
When wiki pages are ready to be presented to the world, you push them to github wiki pages. Instructions on pushing to a remote repository are found here.
Recent Comments