Maven - Automate Software Compilation and Deployment

with
 
Some Eclipse Tricks included
 
What is it?
 
Tool for automatizing your software and test compilation also
deployment
Add jar files (dependencies) by just adding some text to XML file
Compile your test cases and your software
Run your test cases
Create a jar file for your software
 
Why you need that?
 
Big Company job
You may have different libraries you are using >10
Don’t want to make human mistake for deployment
Running test
 
Commands?
 
clean: clean the generated stuff
compile:compile your software
test-compile:compile test classes:JUnit
test: run the tests
install: create jar file
 
How to install?
 
Create JAVA_HOME path:
 C:\Program Files\Java\
jdk
1.7.0_51
Add maven to your path:
 C:\Program Files\apache-maven-
3.3.9\bin
Run mvn –v
 
 
 
https://maven.apache.org/install.html
 
How to add path in Windows
 
Let me show you!
 
 
 
 
 
Or see this:
http://www.computerhope.com/issues/ch000549.htm
 
Install                     Plugin in
 
Help>Eclipse Marketplace
Find 
Maven
Install 
Maven Integration for Eclipse
 
Create a                   Project with
 
File>New>Other >Maven Project
 
Key Points in
 
groupId:PackageName
Artifact:projectname
version:1.0-SNAPSHOT
 
 
Creating Jar file-install
 
You need to add this to POM.xml
 
 
<build>
<plugins>
<plugin>
<artifactId>
maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.somemaven.somemavenProject.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>${
basedir}/target/dependency</directory>
</resource>
</resources>
</build>
 
Eclipse can also create a Jar file!
 
You need to clean first from Eclipse (Project>Clean)
Run or run as «Java Application»
Right click on Project
Export
You may add/not add the jar files
Done
 
Prepared by:
 
Salih Safa BACANLI
bacanli@knights.ucf.edu
Slide Note
Embed
Share

Learn how Maven can simplify your software development process by automating compilation, testing, and deployment tasks. This tool helps manage dependencies, run test cases, and create executable JAR files efficiently. Follow step-by-step instructions to set up Maven, configure your project, and create JAR files seamlessly for your Java applications.

  • Maven
  • Software Development
  • Automation
  • Deployment
  • Testing

Uploaded on Sep 12, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. with

  2. What is it? Tool for automatizing your software and test compilation also deployment Add jar files (dependencies) by just adding some text to XML file Compile your test cases and your software Run your test cases Create a jar file for your software

  3. Why you need that? Big Company job You may have different libraries you are using >10 Don t want to make human mistake for deployment Running test

  4. Commands? clean: clean the generated stuff compile:compile your software test-compile:compile test classes:JUnit test: run the tests install: create jar file

  5. How to install? Create JAVA_HOME path: C:\Program Files\Java\jdk1.7.0_51 Add maven to your path: C:\Program Files\apache-maven- 3.3.9\bin Run mvn v https://maven.apache.org/install.html

  6. How to add path in Windows Let me show you! Or see this: http://www.computerhope.com/issues/ch000549.htm

  7. Install Plugin in Help>Eclipse Marketplace Find Maven Install Maven Integration for Eclipse

  8. Create a Project with File>New>Other >Maven Project

  9. Key Points in groupId:PackageName Artifact:projectname version:1.0-SNAPSHOT

  10. Creating Jar file-install You need to add this to POM.xml <build> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <version>3.0.2</version> <configuration> <archive> <manifest> <mainClass>com.somemaven.somemavenProject.App</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack-dependencies</id> <phase>package</phase> <goals> <goal>unpack-dependencies</goal> </goals> </execution> </executions> </plugin> </plugins> <resources> <resource> <directory>${basedir}/target/dependency</directory> </resource> </resources> </build>

  11. Eclipse can also create a Jar file! You need to clean first from Eclipse (Project>Clean) Run or run as Java Application Right click on Project Export You may add/not add the jar files Done Prepared by: Salih Safa BACANLI bacanli@knights.ucf.edu

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#