Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added gradle-tooling doc. splitted up the tooling into maven/gradle/cli #1194

Merged
merged 1 commit into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions docs/src/main/asciidoc/cli-tooling.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
= Building {project-name} apps with {project-name} Command Line Interface (CLI)

== Installing the CLI

The {project-name} CLI is provided as a native binary for Linux and macOS or as a jar-file for
all operating systems.

=== Native CLI

Download the binaries here:

* https://coming-soon[Linux Binary] (coming soon)
* https://coming-soon[macOS Binary] (coming soon)

We recommend that you create a specific {project-name} folder, eg '~/quarkus' and move the
binary there.
Then in your shell profile (for Bash shell edit '~/.bash_profile'), export the 'QUARKUS_HOME'
folder and add that to your 'PATH':

[source]
export QUARKUS_HOME=/path/to/quarkus-cli
export PATH="$PATH:$QUARKUS_HOME"

Reload your terminal or do:

[source]
source ~/.bash_profile

Now you can run the {project-name} CLI:

[source]
$ quarkus --help

This will display the help information with all the available commands.

[source]
$ quarkus -i

This will start the {project-name} CLI in interactive mode.

=== Jar CLI

Download the jar-file here:
* https://coming-soon[jar-file] (coming soon)

As with the native CLI we recommend that you copy the binary to a specific folder, eg '~/quarkus'.
The jar file requires Java 8 or newer to run. To start the CLI:

[source]
$ java -jar quarkus-cli.jar

The jar file CLI accepts all the same options and commands as the native binary.

Note: In the examples below switch out 'quarkus' with 'java -jar quarkus-cli.jar'.


[[project-creation]]
== Creating a new project

To create a new project we use the create-project command:

[source]
$ quarkus create-project hello-world

This will create a folder called 'hello-world' in your current working directory using default
groupId, artifactId and version values
(groupId='com.acme', artifactId='quarkus' and version='1.0.0-SNAPSHOT').

To specify the groupId, artifactId and version values,
use the '--groupid', '--artifactid' and '--version' options:

[source]
$ quarkus create-project --groupid=com.foo --artifactId=bar --version=1.0 hello-world


Use the help option to display all the possible options:

[source]
$ quarkus create-project --help

== Dealing with extensions

The {project-name} CLI can obtain a list of the available extensions with:

[source]
$ quarkus list-extensions

To more easily get an overview and only display the extension names:

[source]
$ quarkus list-extensions -n


== Adding extension(s)

The {project-name} CLI can add {project-name} extensions to your project with the 'add-extension'
command:

[source]
$ quarkus add-extension --extension=hibernate-validator /path/to/my/project

The argument path either needs to be the base folder for the project or a direct path to the
build file.

== Development mode

To start dev mode from the {project-name} CLI do:

[source]
$ quarkus dev /path/to/my/project

As with 'add-extension' the argument path needs to be the base folder for the project or a
direct path to the build file.


27 changes: 27 additions & 0 deletions docs/src/main/asciidoc/gradle-config.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
= {project-name} - Gradle Plugin Repositories

// tag::repositories[]
{project-name} Gradle plugin is not yet published to the https://plugins.gradle.org/[Gradle Plugin Portal],
so you need to add the following to your '~/.gradle/init.gradle' file:
[source, groovy, subs=attributes+]
----
allprojects {
buildscript { <1>
repositories {
mavenCentral()
}
dependencies {
classpath 'io.quarkus:quarkus-gradle-plugin:{quarkus-version}'
}
}
repositories {
mavenCentral()
}
}
----

<1> The buildscript block is needed for the {project-name} Gradle plugin.

Alternatively you add the buildscript and repositories blocks in your `build.gradle` file.

// end::repositories[]
170 changes: 170 additions & 0 deletions docs/src/main/asciidoc/gradle-tooling.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
= Building {project-name} apps with Gradle

== Gradle configuration

Configure Gradle as indicated in the link:gradle-config.html[Gradle configuration page].

At the moment there is no way of automatically generating a new project using the {project-name} Gradle plugin,
luckily setting up a {project-name} project with Gradle is very simple. You only need to add the {project-name} Gradle plugin like this:

[source,groovy,subs=attributes+]
----
apply plugin: 'io.quarkus.gradle.plugin'
----
Note: If you did not follow the steps indicated in the link:gradle-config.html[Gradle configuration page]
you need to add this block to your 'build.gradle' file as well:

[source,groovy,subs=attributes+]
----
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.quarkus:quarkus-gradle-plugin:{quarkus-version}'
}
}
----

[[project-creation]]
== Creating a new project

For now we have to manually create a Gradle project file for {project-name}.
Here is a complete sample file for a simple rest project:

[source,groovy,subs=attributes+]
----
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'io.quarkus.gradle.plugin' <1>


group = 'org.acme'
version = '1.0-SNAPSHOT'

buildscript { <2>
repositories {
mavenCentral()
}
dependencies {
classpath 'io.quarkus:quarkus-gradle-plugin:{quarkus-version}'
}
}

repositories { <3>
mavenCentral()
}

dependencies { <4>
compileOnly group: 'io.quarkus', name: 'quarkus-resteasy-deployment', version:'{quarkus-version}'
}
----

<1> The {project-name} plugin needs to be applied.
<2> The buildscript block can be omitted if you added it to your '~/.gradle/init.gradle' file.
<3> The repositories block can be omitted if you added it to your '~/.gradle/init.gradle' file.
<4> This dependency is needed for a rest application similar to the getting started example.


== Dealing with extensions

From inside a {project-name} project, you can obtain a list of the available extensions with:

[source]
gradle list-extensions

Functionality to automatically add extensions to your Gradle project is not implemented yet (coming soon).

== Development mode

{project-name} comes with a built-in development mode.
Run you application with:

[source]
gradle quarkus-dev

You can then update the application sources, resources and configurations.
The changes are automatically reflected in your running application.
This is great to do development spanning UI and database as you see changes reflected immediately.

`quarkus-dev` enables hot deployment with background compilation, which means that when you modify
your Java files or your resource files and refresh your browser these changes will automatically take effect.
This works too for resource files like the configuration property file.
The act of refreshing the browser triggers a scan of the workspace, and if any changes are detected the
Java files are compiled, and the application is redeployed, then your request is serviced by the
redeployed application. If there are any issues with compilation or deployment an error page will let you know.

Hit `CTRL+C` to stop the application.

== Debugging

You can run a {project-name} application in debug mode using:

[source]
gradle quarkus-dev --debug=true

Then, attach your debugger to `localhost:5005`.

== Import in your IDE

Once you have a <<project-creation, project generated>>, you can import it in your favorite IDE.
The only requirement is the ability to import a Gradle project.

**Eclipse**

In Eclipse, click on: `File -> Import`.
In the wizard, select: `Maven -> Existing Gradle Project`.
On the next screen, select the root location of the project.
The next screen list the found modules; select the generated project and click on `Finish`. Done!

In a separated terminal, run `gradle quarkus-dev`, and enjoy a highly productive environment.

**IntelliJ**

In IntelliJ:

1. From inside IntelliJ select `File -> New -> Project From Existing Sources...` or, if you are on the welcome dialog, select `Import project`.
2. Select the project root
3. Select `Import project from external model` and `Gradle`
4. Next a few times (review the different options if needed)
5. On the last screen click on Finish

In a separated terminal or in the embedded terminal, run `gradle quarkus-dev`. Enjoy!

**Apache Netbeans**

In Netbeans:

1. Select `File -> Open Project`
2. Select the project root
3. Click on `Open Project`

In a separated terminal or the embedded terminal, go to the project root and run `gradle quarkus-dev`. Enjoy!

**Visual Studio Code**

Open the project directory in VS Code. If you have installed the Java Extension Pack (grouping a set of Java extensions), the project is loaded as a Gradle project.

== Building a native image

Native images make {project-name} applications ideal for containers and serverless workloads.

Make sure to have `GRAALVM_HOME` configured and pointing to GraalVM version {graalvm-version}.

Create a native executable using: `gradle quarkus-native`.
A native executable will be present in `build/`.

=== Build a container friendly executable

The native executable will be specific to your operating system.
To create an executable that will run in a container, use the following:

[source, bash]
----
gradle quarkus-native --docker-build=true
----

The produced executable will be a 64 bit Linux executable, so depending on your operating system
it may no longer be runnable.
However, it's not an issue as we are going to copy it to a Docker container.

57 changes: 0 additions & 57 deletions docs/src/main/asciidoc/maven-config.adoc

This file was deleted.

Loading