Andrey Hihlovskiy
Professional blog on groovy, gradle, Java, Javascript and other stuff.
Category Archives: Uncategorized
Adding an optional internal artifactory repository to Gradle to speed up builds
May 26, 2014
Posted by on 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
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.
Gretty version 0.0.16 is out!
May 13, 2014
Posted by on 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!
May 5, 2014
Posted by on 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.
Gretty version 0.0.15 is out!
April 4, 2014
Posted by on I release Gretty (gradle plugin for jetty) version 0.0.15!
New: fast-reload of webapp-resources, jdk8-compatibility.
Sources and documentation at https://github.com/akhikhl/gretty.
Also available on jcenter & maven central!
What is the cardinality of the Euclidean topology?
March 9, 2014
Posted by on David Richeson: Division by Zero
I’m teaching topology this semester. The students are looking at different topologies on the real number line. For homework I asked them to think about which topologies are “the same” (if any) and which are “different,” and why they thought that was the case. We haven’t yet talked about continuous maps or homeomorphisms, so I told them that two topologies were the same if we could rename all of the points so that one topology turned into the other.
They came back with the answers I expected. For example, the trivial topology has only two open sets and all the others have infinitely many, so the trivial topology must be different from the rest. One-point sets are open in the discrete topology, but not in any of the others, so it must be different from the rest.
One student pointed out that the discrete topology is the power set of…
View original post 322 more words
Deploying Spring Boot Groovy scripts as a Jar file in Cloud Foundry
February 28, 2014
Posted by on Tomás Lin's Programming Brain Dump
This post is a step by step guide on deploying a Spring Boot application on Cloud Foundry using the spring jar feature introduced in 1.0.0.RC2.
If you read the Cloud Foundry documentation, they would claim that the proper way to deploy Spring Boot Groovy scripts is via:
spring grab *.groovy cf push
Unfortunately, this approach is almost as effective as Sex Panther Cologne.
It fails badly when you try to include other starter packs, such as the websocket starter pack.
Using the jar approach outlined here allows us to overcome the errors that you might encounter in Cloud Foundry otherwise.
View original post 354 more words
Gretty version 0.0.12 is out!
February 24, 2014
Posted by on Gretty is a feature-rich gradle plugin for running web-applications under jetty.
New in version 0.0.12: support of integration tests.
Full sources, documentation and examples: https://github.com/akhikhl/gretty
Gretty 0.0.12 is also available on maven central under group “org.akhikhl.gretty”.
How to teach your kids to draw fractals
February 10, 2014
Posted by on It’s probably one of the best things that computer-geek dad/mom can teach their kid – to draw fractals with LOGO. Here is how you do it:
- Install Kturtle or similar LOGO software
- Refresh your knowledge on fractals (for example, at the excellent website of Jeffrey Ventrella)
- Look at the examples of turtle graphics and fractals on the Internet
- Repeat (together with your kid) very basic stuff from geometry: how to add/subtract angles, triangle postulate, etc.
Then fun begins:
- 30 minutes exercise implementing Koch Curve
- 1 hour exercise implementing Sierpinsky Triangle
- 1.5 hour exercise implementing various fractal trees
- 1 hour implementing Dragon Curve
- etc. etc.
Some very important things to remember:
- don’t overload your kid with knowledge. It’s important to get to exercises ASAP, otherwise motivation is lost.
- at first do every exercise yourself, without the kid. This way you make sure that you understand the goals and methods of implementation and can deliver that understanding to a kid.
- be clear at formulating goals and algorithms, show on paper how stuff works.
- don’t try to be overly supportive, give a kid space to think and experiment with implementation.
- ask kid questions and stimulate thinking: “what about changing this parameter here, how will it affect our fractal”?
- don’t try to do all exercises at once – this would not be effective, since the brain needs time to digest new concepts.
This could be the beginning of your kids’ big love – love to mathematics and science.
Illustration: Sierpinsky Triangle, created by my daughter with Kturtle:
The source code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
learn triangle $x { | |
fw $x | |
tr 120 | |
fw $x | |
tr 120 | |
fw $x | |
tr 120 | |
} | |
learn serpinsky $x, $level { | |
triangle $x | |
pu | |
fw $x/2 | |
tr 60 | |
pd | |
serpinsky1 $x/2, $level | |
} | |
learn serpinsky1 $x, $level { | |
if $level == 0 { | |
return | |
} | |
triangle $x | |
pu | |
tl 60 | |
fw $x/2 | |
tr 60 | |
pd | |
serpinsky1 $x/2, $level – 1 | |
pu | |
tr 60 | |
fw $x | |
tl 60 | |
pd | |
serpinsky1 $x/2, $level – 1 | |
pu | |
tr 180 | |
fw $x | |
tl 180 | |
pd | |
serpinsky1 $x/2, $level – 1 | |
pu | |
tl 60 | |
fw $x/2 | |
tr 60 | |
pd | |
} | |
$level = 7 | |
reset | |
go 120, 0 | |
print "Serpinsky carpet level " + $level | |
pu | |
go 0, 400 | |
pd | |
dir 30 | |
serpinsky 400, $level |
Recent Comments