maven开发插件pom.xml配置

楼主
我是社区第123716位番薯,欢迎点我头像关注我哦~
<?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">
<parent>
<artifactId></artifactId>
<groupId></groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>plugin-test</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.test.skip>true</maven.test.skip>
<maven.javadoc.skip>true</maven.javadoc.skip>
<isEncrypt>true</isEncrypt>
</properties>

<build>
<outputDirectory>${project.basedir}/classes/</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>auto-clean</id>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>my.prepare-package</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target if="${isEncrypt}">
<property name="compile_classpath" refid="maven.compile.classpath"/>
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask">
<classpath path="${env.JAVA_HOME}/lib/tools.jar"/>
<!--suppress UnresolvedMavenProperty -->
<classpath path="${compile_classpath}"/>
</taskdef>
<pretreatment baseDir="${basedir}"/>
</target>
</configuration>
</execution>
<execution>
<id>my.package</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<xmlproperty file="plugin.xml" prefix="plugin_info"/>
<!--suppress UnresolvedMavenProperty -->
<property name="plugin_name"
value="plugin-${plugin_info.plugin.id}-${plugin_info.plugin.version}"/>
<!--suppress UnresolvedMavenProperty -->
<property name="plugin_directory"
value="${project.basedir}/../webroot/WEB-INF/plugins/${plugin_name}/"/>
<!--suppress UnresolvedMavenProperty -->
<property name="install_directory"
value="${project.basedir}/../webroot/WEB-INF/plugins/installation_zips/${plugin_name}/"/>

<!--suppress UnresolvedMavenProperty -->
<jar destfile="${plugin_name}.jar" basedir="classes"/>

<zip destfile="plugin_installation.zip">
<!--suppress UnresolvedMavenProperty -->
<zipfileset dir="${project.basedir}" includes="${plugin_name}.jar"/>
<zipfileset dir="${project.basedir}" includes="plugin.xml"/>
<zipfileset dir="${project.basedir}/lib" includes="**/**"/>
</zip>

<!--suppress UnresolvedMavenProperty -->
<copy todir="${plugin_directory}" overwrite="true">
<fileset dir="${project.basedir}" erroronmissingdir="false">
<!--suppress UnresolvedMavenProperty -->
<include name="${plugin_name}.jar"/>
</fileset>
<fileset dir="${project.basedir}" erroronmissingdir="false">
<include name="plugin.xml"/>
</fileset>
<fileset dir="${project.basedir}/lib/" erroronmissingdir="false">
<include name="**/**"/>
</fileset>
</copy>

<!--suppress UnresolvedMavenProperty -->
<copy todir="${install_directory}" overwrite="true">
<fileset dir="${project.basedir}/" erroronmissingdir="false">
<include name="plugin_installation.zip"/>
</fileset>
</copy>

<move file="classes" todir="${project.build.directory}"/>
<move file="plugin_installation.zip" todir="${project.build.directory}"/>
<!--suppress UnresolvedMavenProperty -->
<move file="${plugin_name}.jar" todir="${project.build.directory}"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

 

分享扩散:

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

0回帖数 1关注人数 2104浏览人数
最后回复于:2022-4-12 09:55

任务进行中

    话题进行中...
    返回顶部 返回列表