Skip to content

Instantly share code, notes, and snippets.

@ezhov-da
Last active March 10, 2019 12:22
Show Gist options
  • Save ezhov-da/157aacd852541464c1d1db0ed8224471 to your computer and use it in GitHub Desktop.
Save ezhov-da/157aacd852541464c1d1db0ed8224471 to your computer and use it in GitHub Desktop.
java maven плагин ant
[code:]xml[:code]
<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 &amp;&amp; start 'run' '%JAVA_HOME%\bin\javaw' -jar -Xmx768m '%~dp0\${full.name.jar.without.version}' rem home
]]>
</echo>
<!--Копируем 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>
[/code]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment