Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/01c65054c2570b1f134551a30228b434 to your computer and use it in GitHub Desktop.
Save ezhov-da/01c65054c2570b1f134551a30228b434 to your computer and use it in GitHub Desktop.
java maven сборка проекта для сервиса приложений
[code:]XML[:code]
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.ezhov</groupId>
<artifactId>excel_loader</artifactId>
<version>0.3a</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<directory.extended.dll>dll</directory.extended.dll>
<directory.jdbc.jars>jdbc_jars</directory.jdbc.jars>
<directory.jars>lib</directory.jars>
<version.file>config.properties</version.file>
<app.const.version.file>app.version</app.const.version.file>
<name.zip>${project.artifactId}_${project.version}.zip</name.zip>
<folder.application.dist>dist</folder.application.dist>
<full.name.jar.with.version>${project.artifactId}-${project.version}.${project.packaging}</full.name.jar.with.version>
<full.name.jar.without.version>${project.artifactId}.${project.packaging}</full.name.jar.without.version>
</properties>
<name>загрузка данных из excel</name>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fifesoft/rsyntaxtextarea -->
<dependency>
<groupId>org.fife</groupId>
<artifactId>rsyntaxtextarea</artifactId>
<version>1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${directory.jars}/</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>ru.ezhov.excelloader.Application</mainClass>
<classpathPrefix>${directory.jars}/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>copy-write-cmd</id>
<phase>package</phase>
<configuration>
<target>
<!--===========================================================
СОБИРАЕМ ПРОЕКТ В АРХИВ ДЛЯ РАЗВЕРТЫВАНИЯ НА СЕРВЕРЕ ПРИЛОЖЕНИЙ
============================================================-->
<!-- Создаем файл с версией-->
<echo file="${project.build.directory}/${folder.application.dist}/${version.file}" append="true">
<![CDATA[
${app.const.version.file}=${project.version}
]]>
</echo>
<!--Создаем bat для запуска-->
<echo file="${project.build.directory}/${folder.application.dist}/run.bat" append="true">
<![CDATA[
cd /d %~dp0 && start "run" "%JAVA_HOME%\bin\javaw" -jar -Xmx768m "%~dp0\${full.name.jar.without.version}" rem home
]]>
</echo>
<!--Копируем дополнительные папки в dist-->
<copy todir="${project.build.directory}/${folder.application.dist}/${directory.extended.dll}">
<fileset dir="${directory.extended.dll}"/>
</copy>
<copy todir="${project.build.directory}/${folder.application.dist}/${directory.jdbc.jars}">
<fileset dir="${directory.jdbc.jars}"/>
</copy>
<copy todir="${project.build.directory}/${folder.application.dist}/${directory.jars}">
<fileset dir="${project.build.directory}/${directory.jars}"/>
</copy>
<!--Копируем jar файл в директорию для сборки-->
<copy file="${project.build.directory}/${full.name.jar.with.version}"
tofile="${project.build.directory}/${folder.application.dist}/${full.name.jar.without.version}"/>
<!--пакуем в архив-->
<zip destfile="${project.build.directory}/${folder.application.dist}/${name.zip}"
basedir="${project.build.directory}/${folder.application.dist}"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
[/code]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment