Use IntelliJ IDEA to create an EXECUTABLE JAR With Dependencies Using Maven

Begin Secure September 12, 2022
Video Thumbnail
Begin Secure Logo

Begin Secure

View Channel

About

Welcome to Begin Secure My name is Brian. With 20+ years in software development, from startups to Fortune 500s, I now focus on application security in finance. My background in computer science drives the essence of this channel. Our Focus Begin Secure emphasizes security in software development. We delve into Java, Spring, Python, and DevOps, but our core is a security-first coding approach. Why Us? Security isn't an afterthought—it's vital. We bridge software development and application security, equipping developers for secure coding. For Whom? From seasoned developers to newcomers, our content is universally relevant. Join discussions in comments, our community tab, or on Discord.

Video Description

In this video, we will use IntelliJ IDEA to create an executable jar file using Maven. Keep watching until the end of the video to see a second way to create an executable jar that will take up less space in your deployments, so you can optimize your images. We're using IntelliJ IDEA Community Edition, which is free. Using IntelliJ is a great way to make programming more productive and enjoyable. ▬▬▬▬▬▬ T I M E S T A M P S ⏰ ▬▬▬▬▬▬ 00:00 *Create the project* 02:30 *Review Maven setup* 03:10 *Add first dependency* 03:40 *Security Alert* 05:45 *Add second dependency* 07:41 *Execute the jar file* 09:19 *Modify the code to include the dependency* 11:15 *Package the dependency* 12:19 *Build the artifact* 14:02 *Add Maven plugin to project* 15:10 *Build the code with the new plugin* When IntelliJ is working, I have sped up the boring parts, so we can focus on what's interesting IntelliJ creates our project and provides us with a very basic pom.xml. We see the group and artifact id we provided earlier in our pom file, along with the default version of the 1.0 snapshot. Any recent version of java will be fine, we’ll be using version 11. In the project tool window, we’ll right click on source, main, java and select new java class We’ll supply the name of the package and the class file name at one time Let’s call it com dot beginsecure dot app and press return Intellij creates our class Lets use the live template psvm to generate our main method And we’ll use the live template sout to generate our printline statement In our message, let’s put in the string hello world because of course And let’s run that code just to show that everything is working correctly We see the code runs, prints our message and exits with a return code of 0 Great, everything is working as expected, Let’s take a moment and look at the maven tool window On top we see a list of the lifecycle phases, clean, validate, compile and so forth. A phase is a step in the build lifecycle which is an ordered sequence of steps When a phase, like package, is specified, every phase in the sequence up to and including the one specified is run Below is a list of the plugins that are available to use by default from IntelliJ IDEA When we invoke plugins, we specify a goal to perform. For example, the plugin we might invoke is compiler and the goal is compile Back in the Project tool window, we see the external libraries this project is dependent on For now, JDK 11 is the only thing necessary to build this project Let’s change that and explore how we can add a dependency to our project You can find the code here: https://github.com/BeginSecure/IntelliJExecutableJar.git

You May Also Like

Transform Your Space Today

AI-recommended products based on this video

Loading...
Command Medium Picture Hanging Strips [Removable]: 12 Pairs (White)

Command Medium Picture Hanging Strips [Removable]: 12 Pairs (White)

(23,669)
$10.38
FREE delivery Mon, Sep 15 on your first order
5K+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

(126)
$65.99
FREE delivery Wed, Aug 20
400+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)
Best Seller

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)

(97)
$69.99
PrimeFREE delivery Sat, Jun 14
Loading...
Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

(5)
$74.99
FREE delivery Wed, Aug 20
50+ bought in past month
Loading...
Handmade Custom Reusable Stencils, Personalized Text Stencil for Spray Painting & Sign Making, Durable Plastic, Metal & Wood Stencils, Multiple Material Options, Custom Stencil

Handmade Custom Reusable Stencils, Personalized Text Stencil for Spray Painting & Sign Making, Durable Plastic, Metal & Wood Stencils, Multiple Material Options, Custom Stencil

(0)
$11.99
$13.94 delivery Jul 2 - 22
Loading...
RoboSeal Rechargeable Mason Jar Vacuum Sealer for Mason Jars Wide and Regular, One Touch Vacuum Sealer for Jars, 10 Lids Included, Digital Battery Indicator, As Seen on TV

RoboSeal Rechargeable Mason Jar Vacuum Sealer for Mason Jars Wide and Regular, One Touch Vacuum Sealer for Jars, 10 Lids Included, Digital Battery Indicator, As Seen on TV

(190)
$36.09
Prime
2K+ bought in past month
Loading...
LEGO Icons Bonsai Tree Building Set - Artificial Bonsai Tree Plants for Home Decor, Adults Ages 18+ - Faux, Fake Plants for Table, Desk, Office - Birthday Gift for Men & Women - 10281

LEGO Icons Bonsai Tree Building Set - Artificial Bonsai Tree Plants for Home Decor, Adults Ages 18+ - Faux, Fake Plants for Table, Desk, Office - Birthday Gift for Men & Women - 10281

(22,441)
$59.99
PrimeFREE delivery Sat, Jun 14
600+ bought in past month
Loading...
2 Pack Outdoor Solar Firework Lights, 240 LED Solar Powered Hanging Lights Outdoor Waterproof Hanging Fairy Garden Lights Landscape Lights(Warm White)

2 Pack Outdoor Solar Firework Lights, 240 LED Solar Powered Hanging Lights Outdoor Waterproof Hanging Fairy Garden Lights Landscape Lights(Warm White)

(41)
$25.99
FREE delivery Sat, Jun 14 on your first order
300+ bought in past month
Loading...
Generic Collapsible Washing up Bowl Folding Dish Basin Bucket Portable Dish Pan Foldable Wash Basin for Camping Beach RV Backpacking, Green 38x23.5x11.5cm

Generic Collapsible Washing up Bowl Folding Dish Basin Bucket Portable Dish Pan Foldable Wash Basin for Camping Beach RV Backpacking, Green 38x23.5x11.5cm

(0)
$12.19
FREE delivery Aug 18 - 28
Loading...
FANGOR 10.1 Inch WiFi Digital Picture Frame 1280x800 HD IPS Touch Screen, Electronic Smart Photo Frame with 32GB Storage, Auto-Rotate, Instantly Share Photos/Videos via Uhale App from Anywhere

FANGOR 10.1 Inch WiFi Digital Picture Frame 1280x800 HD IPS Touch Screen, Electronic Smart Photo Frame with 32GB Storage, Auto-Rotate, Instantly Share Photos/Videos via Uhale App from Anywhere

(1,411)
$59.99
FREE delivery Wed, Aug 20
100+ bought in past month
Loading...
Skylight Digital Picture Frame - WiFi Enabled with Load from Phone Capability, Touch Screen Digital Photo Frame Display - Customizable Gift for Friends and Family - 10 Inch Black

Skylight Digital Picture Frame - WiFi Enabled with Load from Phone Capability, Touch Screen Digital Photo Frame Display - Customizable Gift for Friends and Family - 10 Inch Black

(22,633)
$159.00$127.20
FREE delivery Wed, Aug 20
300+ bought in past month
Loading...
Aura Carver WiFi Digital Picture Frame | The Best Digital Frame for Gifting | Send Photos from Your Phone | Quick, Easy Setup in Aura App | Free Unlimited Storage | Gravel with White Mat

Aura Carver WiFi Digital Picture Frame | The Best Digital Frame for Gifting | Send Photos from Your Phone | Quick, Easy Setup in Aura App | Free Unlimited Storage | Gravel with White Mat

(4,128)
$179.00
PrimeFREE delivery Sat, Jun 14
400+ bought in past month
Loading...
Frameo 10.1 Inch WiFi Digital Picture Frame, 1280x800 HD IPS Touch Screen Photo Frame Electronic, 32GB Memory, Auto-Rotate, Wall Mountable, Share Photos/Videos Instantly via Frameo App from Anywhere Global Recycled Standard
Best Seller

Frameo 10.1 Inch WiFi Digital Picture Frame, 1280x800 HD IPS Touch Screen Photo Frame Electronic, 32GB Memory, Auto-Rotate, Wall Mountable, Share Photos/Videos Instantly via Frameo App from Anywhere Global Recycled Standard

(7,813)
$69.99$62.30
FREE delivery Thu, Sep 4
1K+ bought in past month
Loading...
UMI 110V to 220V Step Up Voltage Converter LX-300C Toroidal Transformer for 220V Appliances to Be Used in US, Simple White Plastic Shell, Safe and Effective

UMI 110V to 220V Step Up Voltage Converter LX-300C Toroidal Transformer for 220V Appliances to Be Used in US, Simple White Plastic Shell, Safe and Effective

(360)
$75.99
FREE delivery Sat, Jun 28
Loading...
4-Ft Vertical Garden Planter for Outdoor and Indoor Plants - Elevated Planter with 4 Rectangular Plastic Planter Boxes for Patio and Balcony (1-Pack/Espresso Brown)

4-Ft Vertical Garden Planter for Outdoor and Indoor Plants - Elevated Planter with 4 Rectangular Plastic Planter Boxes for Patio and Balcony (1-Pack/Espresso Brown)

(685)
$109.98
PrimeFREE delivery Sat, Jun 14
100+ bought in past month
Loading...
echo-ove 8 Oz (250ml) White Plastic Cosmetic Jars with Inner Liners and Dome Lids Refillable Make-up Cosmetic Containers Pot Case for Scrubs Oils Salves Creams Lip Balm Lotions Nail Accessories Pack of 6

echo-ove 8 Oz (250ml) White Plastic Cosmetic Jars with Inner Liners and Dome Lids Refillable Make-up Cosmetic Containers Pot Case for Scrubs Oils Salves Creams Lip Balm Lotions Nail Accessories Pack of 6

(347)
$14.55
FREE delivery Sat, Jun 14 on your first order
Loading...
TP-Link 5 Port Gigabit Ethernet Network Switch (TL-SG1005D) - Plug and Play, Desktop or Wall Mount, Plastic Case, Ethernet Splitter, Fanless, Traffic Optimization, Unmanaged (TL-SG1005D)

TP-Link 5 Port Gigabit Ethernet Network Switch (TL-SG1005D) - Plug and Play, Desktop or Wall Mount, Plastic Case, Ethernet Splitter, Fanless, Traffic Optimization, Unmanaged (TL-SG1005D)

(21,445)
$14.99$13.49
FREE delivery Thu, Sep 4 on your first order
100+ bought in past month
Loading...
HONYUEYIM 2 PCS Handmade Boho Coasters,100% Cotton Woven Macrame Absorbent Coasters for Drinks,Heat Resistant Office Cotton Coasters for Coffee Table,Desk Kitchen Dining Room Kitchen,Housewarming Gift (Pink)

HONYUEYIM 2 PCS Handmade Boho Coasters,100% Cotton Woven Macrame Absorbent Coasters for Drinks,Heat Resistant Office Cotton Coasters for Coffee Table,Desk Kitchen Dining Room Kitchen,Housewarming Gift (Pink)

(2)
$14.43
FREE delivery Sun, Jul 6 on your first order
Loading...
HONYUEYIM 2 PCS Handmade Boho Coasters,100% Cotton Woven Macrame Absorbent Coasters for Drinks,Heat Resistant Office Cotton Coasters for Coffee Table,Desk Kitchen Dining Room Kitchen,Housewarming Gift (White)

HONYUEYIM 2 PCS Handmade Boho Coasters,100% Cotton Woven Macrame Absorbent Coasters for Drinks,Heat Resistant Office Cotton Coasters for Coffee Table,Desk Kitchen Dining Room Kitchen,Housewarming Gift (White)

(2)
$15.19
FREE delivery Sat, Jun 14 on your first order