Difference between revisions of "IT-SDK-Maven"
Jump to navigation
Jump to search
Samerhijazi (talk | contribs) (Created page with "* https://maven.apache.org/ * https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html <pre class="code"> mvn install:install-file -Dfile=<path-to-file> -DgroupId=...") |
(→Creating a Project) |
||
| (9 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| + | =Ref.= | ||
* https://maven.apache.org/ | * https://maven.apache.org/ | ||
| + | * https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html | ||
* https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html | * https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html | ||
| + | |||
| + | =Proxy= | ||
| + | *https://maven.apache.org/settings.html#Proxies | ||
| + | <pre class="code"> | ||
| + | </pre> | ||
| + | |||
| + | =Creating a Project= | ||
| + | <pre class="code"> | ||
| + | mvn archetype:generate -DartifactId=app -DgroupId=com.company.app -DinteractiveMode=false | ||
| + | mvn archetype:generate -DartifactId=app -DgroupId=com.company.app -DinteractiveMode=false -DarchetypeArtifactId=maven-archetype-quickstart | ||
| + | </pre> | ||
| + | |||
| + | =Install Pachage= | ||
<pre class="code"> | <pre class="code"> | ||
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> | mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> | ||
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile> | mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile> | ||
| + | </pre> | ||
| + | =Maven Phases= | ||
| + | <pre class="code"> | ||
| + | mvn clean # cleans up artifacts created by prior builds | ||
| + | mvn validate # validate the project is correct and all necessary information is available | ||
| + | mvn compile # compile the source code of the project | ||
| + | mvn package # take the compiled code and package it in its distributable format, such as a JAR. | ||
| + | mvn install # install the package into the local repository, for use as a dependency in other projects locally | ||
| + | mvn deploy # done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects. | ||
| + | </pre> | ||
| + | =Maven POM= | ||
| + | <pre class="code"> | ||
| + | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| + | <modelVersion>4.0.0</modelVersion> | ||
| + | <groupId>com.company</groupId> | ||
| + | <artifactId>mqtt-mvn</artifactId> | ||
| + | <version>1.0-SNAPSHOT</version> | ||
| + | <packaging>jar</packaging> | ||
| + | <name>mqtt-mvn</name> | ||
| + | <properties> | ||
| + | <compiler-plugin.version>3.8.1</compiler-plugin.version> | ||
| + | <maven.compiler.release>11</maven.compiler.release> | ||
| + | <maven.compiler.source>1.8</maven.compiler.source> | ||
| + | <maven.compiler.target>1.8</maven.compiler.target> | ||
| + | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| + | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
| + | </properties> | ||
| + | <dependencies> | ||
| + | <dependency> | ||
| + | <groupId>com.hivemq</groupId> | ||
| + | <artifactId>hivemq-mqtt-client</artifactId> | ||
| + | <version>1.3.0</version> | ||
| + | </dependency> | ||
| + | </dependencies> | ||
| + | <build> | ||
| + | <plugins> | ||
| + | <plugin> | ||
| + | <groupId>org.apache.maven.plugins</groupId> | ||
| + | <artifactId>maven-compiler-plugin</artifactId> | ||
| + | <version>3.8.1</version> | ||
| + | <configuration> | ||
| + | <source>1.8</source> | ||
| + | <target>1.8</target> | ||
| + | </configuration> | ||
| + | </plugin> | ||
| + | </plugins> | ||
| + | </build> | ||
| + | </project> | ||
</pre> | </pre> | ||
Latest revision as of 09:45, 31 August 2022
Ref.
- https://maven.apache.org/
- https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
- https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
Proxy
Creating a Project
mvn archetype:generate -DartifactId=app -DgroupId=com.company.app -DinteractiveMode=false mvn archetype:generate -DartifactId=app -DgroupId=com.company.app -DinteractiveMode=false -DarchetypeArtifactId=maven-archetype-quickstart
Install Pachage
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging> mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>
Maven Phases
mvn clean # cleans up artifacts created by prior builds mvn validate # validate the project is correct and all necessary information is available mvn compile # compile the source code of the project mvn package # take the compiled code and package it in its distributable format, such as a JAR. mvn install # install the package into the local repository, for use as a dependency in other projects locally mvn deploy # done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
Maven POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>mqtt-mvn</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mqtt-mvn</name>
<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.hivemq</groupId>
<artifactId>hivemq-mqtt-client</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>