How to create a new Gradle + Java + Jar project in Intellij 2016.03

I will summarize how to create a Gradle + Java project using Intellij 2016.03 and output a jar file.

Open the new project wizard, select Gradle from the left and Java on the right. imgTemp-2016-12-31-00-05-41.png

Enter the group ID, artifact ID, and version. This value can be changed later. imgTemp-2016-12-31-00-14-06.png

Project settings. It is important to check Create directories for empty content roots automatically. imgTemp-2016-12-31-01-32-35.png

Specifying the project name and directory path imgTemp-2016-12-31-02-43-22.png

This completes the new project creation. The screen looks like this. imgTemp-2016-12-31-03-06-28.png

Then call the static main method to make it executable.

imgTemp-2016-12-31-03-19-12.png

Then press refresh in the Gradle window. Although it is already displayed in the figure, the application run task is added.

imgTemp-2016-12-31-03-21-08.png

Then write the sample source. At this stage, you can see that the external library is available. The processing content has no particular meaning.

imgTemp-2016-12-31-03-22-40.png

Then double-click run to run it.

imgTemp-2016-12-31-03-21-08.png

Next, create a jar file. Add a block of jars to your gradle file. imgTemp-2016-12-31-03-26-54.png

Then run the jar task imgTemp-2016-12-31-03-27-38.png

A jar file is created. The path may be a little confusing. imgTemp-2016-12-31-03-31-06.png

Since it is an executable jar, it can be executed as it is imgTemp-2016-12-31-03-32-47.png

bonus

To respecify the group artifact version, rewrite the following: Rewriting the artifact (rootProject.name) has a wide range of influence, so it is better not to rewrite it too much.

imgTemp-2016-12-31-14-31-30.png

imgTemp-2016-12-31-14-30-59.png

Recommended Posts

How to create a new Gradle + Java + Jar project in Intellij 2016.03
How to create a Spring Boot project in IntelliJ
How to create a data URI (base64) in Java
[Java] How to create a folder
Create Java Spring Boot project in IntelliJ
How to display a web page in Java
Try to create a bulletin board in Java
How to create a theme in Liferay 7 / DXP
Java tips-Create a Spring Boot project in Gradle
[1st] How to create a Spring-MVC framework project
How to easily create a pull-down in Rails
How to create a server executable JAR and WAR with Spring gradle
How to read log4j configuration file in Java project summarized in jar file Memo
[Spring Boot] How to create a project (for beginners)
How to output jar with main class specified by gradle in Intellij IDEA
I tried to create a Clova skill in Java
How to convert A to a and a to A using AND and OR in Java
How to convert a file to a byte array in Java
How to create a method
[Java] How to start a new line with StringBuilder
Until you create a Spring Boot project in Intellij and push it to Github
Create a Java Servlet and JSP WAR file to deploy to Apache Tomcat 9 in Gradle
How to create a lightweight container image for Java apps
Create a jar file that can be executed in Gradle
How to store a string from ArrayList to String in Java (Personal)
Create a method to return the tax rate in Java
Set up Gradle multi-project in IntelliJ to build JAR file
How to dynamically switch JDK when building Java in Gradle
How to develop and register a Sota app in Java
How to simulate uploading a post-object form to OSS in Java
How to create a service builder portlet in Liferay 7 / DXP
Build a Java project with Gradle
Do HelloWorld in Java / IntelliJ / Gradle
How to run Ant in Gradle
How to make a Java container
How to learn JAVA in 7 days
Create a new app in Rails
Create a Java project using Eclipse
How to use classes in Java?
How to make a Maven project
How to name variables in Java
How to make a Java array
How to concatenate strings in java
How to create a jar file or war file using the jar command
I can't create a Java class with a specific name in IntelliJ
How to make a jar file with no dependencies in Maven
How to try Java preview features (such as Java 15 Record) in IntelliJ
How to automatically operate a screen created in Java on Windows
Add a time stamp to the JAR file name in Gradle
How to make a Java calendar Summary
How to implement date calculation in Java
How to implement Kalman filter in Java
Multilingual Locale in Java How to use Locale
Try to solve Project Euler in Java
How to insert a video in Rails
How to add jar file in ScalaIDE
How to do base conversion in Java
[Introduction to Java] How to write a Java program
How to create a Maven repository for 2020
How to make a Discord bot (Java)
Create a TODO app in Java 7 Create Header