Andrey Hihlovskiy

Professional blog on groovy, gradle, Java, Javascript and other stuff.

Monthly Archives: May 2014

Review of Gretty plugin at JAXenter

My open-source project Gretty got a review at JAXenter portal:

http://jaxenter.de/software/Gretty-173718

Is it only me or from now on the sun is shining brighter and birds are signing louder 🙂

Advertisements

Adding an optional internal artifactory repository to Gradle to speed up builds

Tomás Lin's Programming Brain Dump

For Asgard 2, we’re developing heavily with Spring Boot, Groovy and Gradle.

For our jenkins jobs, we found that our internal artifactory repository is much faster than Bintray’s jcenter. Due to the large number of dependencies in the project, a project that takes 30 minutes downloading and building with jcenter only takes 3 minutes using an internal artifactory.

Since our internal repository is only available to us within our network, we don’t really want to expose those credentials in the project we eventually want to open source.

In this post, I will show you how we add an optional internal artifactory repository to our open source builds.

View original post 176 more words

Killer feature in Gretty version 0.0.18 – multiple web-apps support

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

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:

  1. Install required components from OS repositories:
      sudo apt-get install ruby ruby-dev libz-dev libicu-dev build-essential
      

  2. Install Gollum from gems repository:

      sudo gem install gollum
      

  3. 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:

Gollum editing home page

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.

Gretty version 0.0.16 is out!

I release Gretty (gradle plugin for jetty) version 0.0.16!

New:

  • redesigned tasks as two classes: GrettyStartTask and GrettyServiceTask.
  • moved documentation from README.md to wiki pages.
  • drawn beautiful state diagrams for all Gretty tasks.

Sources and documentation at https://github.com/akhikhl/gretty.

Also available on jcenter & maven central!

Wuff version 0.0.1 is out!

Today I release Wuff version 0.0.1!

Wuff is a gradle plugin for automating OSGi/Eclipse-RCP/Eclipse-IDE bundles and applications assembly. It is analog to Eclipse Tycho, but with all power and beauty of gradle.

Full sources and documentation are available here: https://github.com/akhikhl/wuff

Wuff is also available at jcenter and maven central.

Image