GithubHelp home page GithubHelp logo

maven-java-example's Introduction

Validate installation

mvn --version ###################################

Scaffolding a project with Maven

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

Creating a Maven Wrapper

cd {your-project} mvn -N io.takari:maven:wrapper -Dmaven=3.6.2 ####################################

for Heroku deploy

echo 'web: java -Dserver.port=$PORT $JAVA_OPTS -jar target/*.jar' > Procfile #################################### echo '#!/usr/bin/env bash ./mvnw exec:java -q ' > run.sh && chmod 755 run.sh ####################################

create gitignore

gi Linux,VisualStudioCode,Java,Maven >> .gitignore

create git repo

git init gitpub ####################################

Set Properties Java Version

' <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>12</maven.compiler.source> <maven.compiler.target>12</maven.compiler.target> <maven.compiler.release>12</maven.compiler.release> <main.class>MainClass</main.class> <junit.version>4.12</junit.version> <junit.jupiter.version>5.5.2</junit.jupiter.version> <junit.vintage.version>5.5.2</junit.vintage.version> ' ####################################

add dependency slf4j and junit

' org.junit.jupiter junit-jupiter-api ${junit.jupiter.version} test junit junit ${junit.version} test org.junit.jupiter junit-jupiter-engine ${junit.jupiter.version} test org.junit.vintage junit-vintage-engine ${junit.vintage.version} test org.mockito mockito-core 3.0.0 test org.apache.logging.log4j log4j-core 2.12.1 org.apache.logging.log4j log4j-api 2.12.1

'

add line to every class

private static final Logger log = LoggerManager.getLogger(Class.class);

################################## ' maven-surefire-plugin 3.0.0-M3 --enable-preview ' ###################################

execute a Java program with Maven

add plugin to build->plugins tag pom.xml

' org.codehaus.mojo exec-maven-plugin 1.6.0 ${main.class} '

run mnv wrapper

./mvnw clean package ./mvnw exec:java ####################################

add manifest mainfest make a executable jar

add mvn configuration to maven-jar-plugin

' maven-jar-plugin 3.1.1 true ${main.class} ' ####################################

Building a fat jar

' org.apache.maven.plugins maven-assembly-plugin 3.1.1 jar-with-dependencies ${mainClass} make-assembly package single '

remove tag if exist

./mvnw clean package java -jar target/*.jar ####################################

Show the dependency tree

./mvnw dependency:tree -Dverbose ####################################

is newer versions of a dependency available

./mvnw versions:display-dependency-updates ####################################

build block pom.xml example

'

4.0.0

org.robatipoor hello-java-world 0.0.1

hello-java-world

http://www.example.com

UTF-8 12 12 org.robatipoor.App 4.12 5.5.1 5.5.1 org.junit.jupiter junit-jupiter-api ${junit.jupiter.version} test junit junit ${junit.version} test org.junit.jupiter junit-jupiter-engine ${junit.jupiter.version} test org.junit.vintage junit-vintage-engine ${junit.vintage.version} test org.slf4j slf4j-api 1.7.26 org.slf4j slf4j-simple 1.7.26 runtime org.mockito mockito-core 3.0.0 test maven-clean-plugin 3.1.0 maven-resources-plugin 3.0.2 maven-compiler-plugin 3.8.0 12 --enable-preview maven-surefire-plugin 3.0.0-M3 --enable-preview slow maven-jar-plugin 3.1.1 true ${main.class} org.apache.maven.plugins maven-assembly-plugin 3.1.1 jar-with-dependencies ${main.class} make-assembly package single maven-install-plugin 2.5.2 maven-deploy-plugin 2.8.2 maven-site-plugin 3.7.1 maven-project-info-reports-plugin 3.0.0 org.codehaus.mojo exec-maven-plugin 1.6.0 --enable-preview --release 12 ${main.class}

'

maven-java-example's People

Contributors

robatipoor avatar

Watchers

 avatar  avatar

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.