Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a jar from a maven project in intellij

I created a new maven project in IntelliJ and set packaging to jar but when I build it, the target folder does not contain a jar. I'm sure its something really dumb on my part but there are just so many different things i'm reading on different websites and I just feel better asking. enter image description here

like image 433
Joe Avatar asked May 13 '15 02:05

Joe


People also ask

How do I create a JAR file in IntelliJ IDEA?

To create a JAR file from a Maven project in IntelliJ IDEA, go to the Maven Tool Window (View → Tool Windows → Maven), expand your project in the tree, expand Lifecycle, and then double-click on package. Maven will compile your package, and the compiled JAR file will be written to the target/ directory.

How to create a Maven project in IntelliJ?

Creating Web Application using Maven in IntelliJ. 1 Start by creating a new project in IntelliJ. Upon opening IntelliJ, click Create New Project. On the left side, click Maven. Select the Project SDK or ... 2 Create the Folder Structure. 3 Configure pom.xml. 4 Deploying/Running the Project.

How do I create a JAR file from a Maven project?

Let’s see how to do it. To create a JAR file from a Maven project in IntelliJ IDEA, go to the Maven Tool Window (View → Tool Windows → Maven), expand your project in the tree, expand Lifecycle, and then double-click on package. Maven will compile your package, and the compiled JAR file will be written to the target/ directory.

How to use Maven-archetype-Quickstart in IntelliJ IDEA?

maven-archetype-quickstart archetype plugin is used to create a quick and simple java application. Launch IntelliJ IDEA. Click on Create New Project. Select Maven build tool from the left menu. Check the option Create from the archetype. Select the quickstart archetype to create a simple java project and click on the Next button.


2 Answers

You should build you project using IDEA's Maven Projects view.

View -> Tool Windows -> Maven Projects

or open it from left bottom corner menu:

menu

And then build your project with maven goals - i.e. package: maven project

If packaging is set to jar in pom.xml, you will get a jar in target dir.

like image 188
arghtype Avatar answered Oct 03 '22 00:10

arghtype


Go to the maven project and double click clean and package.

For just do following:

enter image description here

like image 42
ankit Avatar answered Oct 02 '22 23:10

ankit