Homebrew’s package index. Profiling and benchmarking tool for Gradle builds. You can install the Gradle build tool on Linux, macOS, or Windows. This document covers installing using a package manager like SDKMAN! Or Homebrew, as well as manual installation. Use of the Gradle Wrapper is the recommended way to upgrade Gradle. You can find all releases and their checksums on the releases page. Gradle homebrew/versions/gradle18 homebrew/versions/gradle24 homebrew/versions/gradle110 homebrew/versions/gradle20 homebrew/versions/gradle26 homebrew/versions/gradle112 homebrew/versions/gradle21 homebrew/versions/gradle27 homebrew/versions/gradle16 homebrew/versions/gradle221 homebrew/versions/gradle28 Caskroom/cask/qlgradle. Homebrew’s package index. Also known as: gradle@6 Open-source build automation tool based on the Groovy and Kotlin DSL. GradleをインストールしたくHomebrewを利用しbrew install gradleをすると下記のようになりインストール出来ません。 $ brew install gradle Updating Homebrew. > Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/cask).
Introduction
So you've decided to give Orchid a try? Great! Follow along with this guide to get yourfirst Orchid site set up, and learn the basics of what you can do with Orchid.
You can follow along with this tutorial on your own, or find the source for this in theOrchidTutorials repository.
First Steps
Orchid is a tool built in Java and Kotlin, and is designed to be run from Gradle. Gradle is a build tool that usesGroovy scripts to configure your build. While it is a super-powerful tool, it can be pretty complex to use and configureon its own, which is why Orchid has an official Gradle plugin that makes it easy for you to get up an running withOrchid even if you aren't familiar with Gradle.
Install Gradle
To start, we'll need to install Gradle. If you're on a Mac, installing Gradle is easily done with Homebrew.
If you're on another operating system, you can find the steps to install it for your system on Gradle'sinstallation page.
Create a Gradle project
Now that you've got Gradle installed, let's go to an empty directory where you want to work on your Orchid site.
In this empty folder, run the following command, which will initialize a Gradle project for you and set up all the filesand folders it needs.
This will make your project look like:
Add Orchid to your Gradle project
Now that we've got our Gradle project set up, let's configure it to be able to run Orchid. First, we'll need to open up
build.gradle
and find the plugins
section.Let's add the
com.eden.orchidPlugin
plugin to this block.By itself, the Orchid Gradle Plugin isn't quite enough to get Orchid running. We'll also need to tell Gradle:
- The Orchid plugins and themes we want to include in our site
- Where it can find those plugins and themes
- Some basic configuration values so Orchid can run properly
To do this, add the following lines to at the end of
build.gradle
.Run Orchid
You now have everything you need to run Orchid and view the site. Go back to your terminal and run the following commandto start Orchid and have it host your site with its local HTTP server so you can preview it.
After a few seconds, you should be able to visit http://localhost:8080 in your browser to seeyour very first Orchid site!
What's Really Going On?
After starting Orchid, you'll see a lot of stuff get logged to the console. Let's step briefly through the output so youcan understand what's going on.
This lets you know which plugins are currently being used. Orchid will auto-load any plugin included in your Gradle
dependencies
block, which themselves may include other plugins, and this will let you know exactly what's being usedin your Orchid site.This shows the command-line flags passed to Orchid from Gradle. This may be helpful for debugging your build,especially if it has been run in a CI environment.
This lets you know which version of Orchid you are using, as well as the version of your site. In addition, it will letyou know which URL your site is currently being served at. By default, this will be
localhost:8080
, but if that portis being used by another process, the port will be changed to the nearest free port.Orchid works in two distinct phases: the indexing phase and the generation phase. During the indexing phase, Orchidwill let all plugins work together to build a model of what your final site will look like. During the generating phase,Orchid returns control to plugins to render all of their pages. This section of output shows you which plugins are beingindexed and generated in which order.
By keeping two distinct phases, Orchid can give all plugins a great way to work together to build up your site, but alsogives everything a guarantee that all the data it needs is there before any pages are rendered. This may not make muchsense right now, but as you get more familiar with Orchid you will start to see the power that this really gives that noother static site generator can match.
The result of all this is that Orchid takes data from many different places (many different plugins), and generates anentire website in your destination directory (the
-d
flag) as static HTML, Javascript, CSS, and other related staticassets.Orchid is a very fast static site generator, with build speed on par with the best tools on the market, despite being somuch more powerful and flexible. Generation time is primarily limited by the raw speed of the template engine renderingyour pages, but this table may help you debug slow builds. Here you can see how many pages Orchid generated, and alsothe total time taken indexing and rendering for each plugin.
The
home
plugin is typically the slowest just because it includes the first page rendered and so the template cachewarm-up time is included in its generation time. For all plugins, you should expect a mean and median generation time tobe pretty similar, and if they are vastly different you may need to see if any of the pages from that plugin are causingissues. This can also help you identify entire plugins that are running very slowly.The larger sites get, the longer the total build time is, but the mean page generation time tends to drop. This is incontrast to most other tools which per-page generation times tend to increase significantly for really large sites. Itis common for the mean generation time to be closer to 20ms or less for individual pages, which means a site ofthousands of pages could easily be built in just a couple minutes, while other tools could easily take 10 minutes ormore (if they can even handle sites of that scale!).
Conclusion
So now that we have a bit of an idea of how to start running Orchid, let's open uphttp://localhost:8080 in our browser. Orchid has built your site into the
build/docs/orchid/
directory and is serving these pages directly with its own lightweight embedded HTTP server. Since an Orchid site isjust a bunch of files on disk being served directly (with no additional server-side processing), you can even stop theOrchid process and start any HTTP server (like this one) in that directoryand you'd get the same result.Congratulations, you now have a basic Orchid site up and running! Let's go back over what we learned:
- Orchid is a command-line tool that is run through Gradle. Orchid provides a plugin for Gradle so that it is easy toget set up and running Orchid without needing to know much about Gradle.
- Orchid is a static site generator, which is a tool that takes content and generates and entire website consistingof only HTML, CSS, and other static files that can be hosted from any webserver.
- Orchid uses a series of plugins to generate your site, and has a unique way of managing the build lifecycle thatactually improves per-page generation times as your site grows, unlike most other tools which tend to slow downdramatically.
Stay tuned for more tutorials on how to use Orchid. We will take what we learned here and expand upon that to learn howto add your first pages to start customizing your site and make it unique.
Did you know that there is a Java build system that does not use angle brackets? More and more projects are using Gradle as an integrated part of their development process. In short, Gradle provides a Groovy DSL for declarative builds based on build conventions. This blog post aims to give you a kickstart if you want to start exploring Gradle yourself by introducing some core concepts and commands.
Installation
If you have not used Gradle before, you must install it first (unless someone has already migrated your project to Gradle, but we get to that later). Windows and Linux users can download the latest binaries from Gradle’s download page and unpack the zip. Make sure that you add the
GRADLE_HOME/bin
folder to your PATH
environment variable.For Mac users, you can use Homebrew to install the latest package:
Verify that the installation works by calling Gradle from your command line:
If everything is ok, you will see information about the Gradle version, your JVM, OS and so on. Please consult the installation guide if you have any problem.
Creating a Project
As of Gradle 1.6 that was released the other day, Gradle provides some support for starting a project from scratch. When executed, the incubating build setup plugin generates some tasks that will generate the basic Gradle files:
Converting a Maven Project
The setup build plugin can also be used to convert a Maven project to a Gradle project. Let’s try it out by first using a Maven archetype to generate a simple Maven project:
Press enter to accept the suggested archetype, i.e. the
maven-archetype-quickstart
, and then press enter once more to accept the latest version. I use com.jayway.gradle.example
as ‘groupId’, and getting-started
as ‘artifactId’. Just keep pressing enter to acknowledge the rest of the suggested default values. Maven generates a simple project with a single class, an accompanying test class and a Maven pom.xml
build script. Step into the directory and make sure that it works by executing Maven’s test command:Now, by invoking the
setupBuild
command the basic content from Maven’s pom.xml
file is extracted and converted into Gradle’s corresponding build.gradle
file:So far so good, now let’s proceed with some actual Gradle work.
Gradle Tasks
Each Gradle project is associated with a set of tasks. Plugin such as the Gradle Java plugin provide their own tasks, and developers can create their own tasks. Consequently, different projects have different tasks. To see what tasks are available for a particular project, the
gradle tasks
command is executed:The available Gradle tasks are listed together with a brief description, e.g.
- build – Assembles and tests this project.
- clean – Deletes the build directory.
- help – Displays a help message
- tasks – Displays the tasks runnable from root project ‘getting-started’ (some of the displayed tasks may belong to subprojects).
- test – Runs the unit tests.
- install – Installs the ‘archives’ artifacts into the local Maven repository.
To execute a task, one simply calls Gradle and the name of the task:
How To Uninstall Packages With Homebrew
As a result, Gradle compiles the source file, compiles the test file and executes the test as one would expect. That is actually several different tasks being executed. Underlying tasks will be executed automatically if required.
Gradle Files
When the
gradle setupBuild
command was executed, a set of files was generated. The build.gradle
is the most important of them:- The first two lines declare the inclusion of two plugins, namely the previously mentioned Java plugin and the Maven plugin.
- The group and version id was imported from the Maven’s pom.xml together with a generated description.
- Next, you may wonder why Gradle has specified such old versions of the Java source and Java target files? Looking at the origin
pom.xml
file does not give any clues, because they were not specified there. The answer resides in Maven’s effective pom (mvn help:effective-pom
) and the implicit usage of the maven-compiler-plugin which uses the 1.5 version by default. Depending on your project deployment environment, upgrading to a more recent version is strongly encouraged. - The repositories and dependencies have also been included from the Maven script.
Another file that was generated was the settings.gradle file, which is used particularly for multi-project builds.
Lastly, the files
gradlew
, gradlew.bat
, gradle/wrapper/gradle-wrapper.jar
and the gradle/wrapper/gradle-wrapper.properties
have all been added by the Gradle Wrapper. The first two files are command line scripts (for *unix and Windows environment respectively) that are used for executing the jar file with the specified properties, which in turn downloads and installs Gradle automatically. In other words, by adding these files to the version control system, it is possible for new team members and continuous integration system to use Gradle without installing Gradle on beforehand. As a bonus, it provides a way for the team to make sure that everyone is using exactly the same version of Gradle for the project they are developing.Gradle Plugins
The purpose of the Gradle Plugins is to enrich projects by adding tasks, dependencies, properties and default values.
Homebrew Gradle Specific Version
The Java plugin was briefly mentioned earlier. One of its features is that it adds the same folder structure convention as Maven (
src/main/java
as root for the production code src/test/java
as root for the test code). The external dependency management system is another important feature provided by the Java plugin.The Maven plugin was also added to the project when it was created. It allows Gradle to interact with Maven based environment, such as installing the binary file to your local Maven repository, uploading it to a remote repository, etc.
Several other plugins are bundled with the Gradle distribution. For example, there is a Jetty plugin, support for development tools such as Eclipse and FindBugs and support for other programming languages such as Scala and Groovy. Additionally, there are a number of external plugins, including the Android Gradle Plugin which one of my colleagues blogged about some time ago.