Code Monkey home page Code Monkey logo

nishkarshraj / maven-using-cmd Goto Github PK

View Code? Open in Web Editor NEW
15.0 4.0 30.0 654 KB

Create a project in Java using Apache Maven Build tool via Command Line and use GitHub Actions to build it on remote Docker Engine.

Home Page: https://iq.opengenus.org/building-java-application-using-apache-maven-command-line/

License: MIT License

Java 84.23% Dockerfile 15.77%
maven maven-repository command-line command-line-tool cmd html css java apache build-automation

maven-using-cmd's Introduction

Apache Maven (Command Line)

Creating a Simple Java Project name: mvn-cmd ๐Ÿ˜„

Step 1: Create the java project

Syntax: mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

Explanation: For beginners,
Only two things are of concern:
1) Group ID: This will be our package name.
2) Artifact ID: This is our project name (mvn-cmd)

Image

Step 2: Check the Directory Structure of created project

At the source folder of the project:
1) src/ 
It contains two folders:
1.1) main/ 
It is used to create codes in java
1.2) test/
It is used to create JUnit Test cases
2) pom.xml 
Pom.xml is the mail build file of the maven!

Image

Step 3: Change the source code (and file name) as you want to make

Go to /src/main/java/pkg1
NOTE: pkg1 is the package name we defined while creating the project.
Always include package name in the code.
Modify the app.java file 
Rename to the file name you want.

Image

Step 4: Clean the project area

Syntax: mvn clean

Before start building a project, it is necessary to delete old configuration files.
mvn clean command is used to delete the target/ folder.

Image

Step 5: Compile the Project source code

Syntax: mvn compile

This command is used to check whether the source code we wrote in java file is correct syntactically or not.

Image

Step 6: Unit Testing

Syntax: mvn test

This work is tricky. 
You must know how to create JUnit Test cases.
You need to define the Unit Test cases in /src/test/pkg1

Image

Step 7: Install (Build the Project)

Checks the Maven Configuration in pom.xml file
Creates the project build.
Creates jar file in target/ folder which can be deployed

Image

Step 8: Site

Syntax: mvn site

Maven Site command is used to create GUI reports
It creates reports in format of web pages in HTML+CSS format.
Site Reports are stored in /target/site

Image

Here is one Web Page of Site Report

Image

How To Contribute

Contribution Guidelines

Contributors

  1. @NishkarshRaj

  2. @navyakanu [Special Thanks for setting up GitHub Actions]

  3. @acodebreaker

  4. @RiyaJohn

  5. @tuhinchakraborty

License

MIT Licence

maven-using-cmd's People

Contributors

acodebreaker avatar dependabot-preview[bot] avatar dependabot[bot] avatar gauravsharma97 avatar mohitsingla123 avatar navyakanu avatar nishkarshraj avatar tuhinchakraborty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

maven-using-cmd's Issues

Static Code Analysis

Perform Static Code Analysis by a tool like SonarQube.
If Quality Check is passed, deploy to a respository artifact, example Nexus
If Quality Check fails, create an automated email system using GitHub Actions to all collaborators.

GitHub Actions fails Maven Build

GitHub Actions for this repository is completed by @navyakanu at #10
But it goes in a long unusual build and keeps failing.
Check for possible changes in yml file to optimize and get it up and working.

Documentation Issues

We have introduced GitHub Actions for:

  1. Maven build on Docker Images
  2. Static code analysis on Maven

Create a complete step by step documentation of how everything works with images.

Jenkins automation

Create a script to trigger Jenkins automation tasks whenever a file is pushed into the source repository.

Deploy Maven Build

Use GitHub Actions to deploy the Maven build to remote repository (preferably Nexus) if static code analysis using SonarQube passes which is referenced in #17

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.