Browse Source

插件打包

persist/10.0
richie 7 years ago
parent
commit
d626676bb7
  1. 21
      plugins/plugin-function/build/assembly/zip.xml
  2. 17
      plugins/plugin-function/plugin.xml
  3. 38
      plugins/plugin-function/pom.xml
  4. 25
      plugins/plugin-function/src/main/java/com/fr/plugin/MyAbs.java
  5. 17
      plugins/pom.xml
  6. 3
      pom.xml

21
plugins/plugin-function/build/assembly/zip.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>Project.release</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/classes</directory>
<outputDirectory>/bin</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>/</outputDirectory>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>

17
plugins/plugin-function/plugin.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.test</id>
<name><![CDATA[测试函数插件]]></name>
<active>yes</active>
<version>1.0</version>
<env-version>10.0</env-version>
<jartime>2018-07-31</jartime>
<vendor>author</vendor>
<description><![CDATA[可以把一组数组都求绝对值]]></description>
<change-notes><![CDATA[
[2018-08-01]修改一点问题。<br/>
[2018-07-31]初始化插件。<br/>
]]></change-notes>
<extra-core>
<FunctionDefineProvider class="com.fr.plugin.MyAbs" name="MyAbs" description="求绝对值,支持数组。"/>
</extra-core>
</plugin>

38
plugins/plugin-function/pom.xml

@ -0,0 +1,38 @@
<?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>
<parent>
<groupId>com.fr.plugin</groupId>
<artifactId>plugins</artifactId>
<version>1.0</version>
</parent>
<packaging>jar</packaging>
<artifactId>plugin-function</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.4</version>
<executions>
<execution>
<id>make-zip</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>build/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</project>

25
plugins/plugin-function/src/main/java/com/fr/plugin/MyAbs.java

@ -0,0 +1,25 @@
package com.fr.plugin;
import com.fr.general.FArray;
import com.fr.general.GeneralUtils;
import com.fr.script.AbstractFunction;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Primitive;
public class MyAbs extends AbstractFunction {
public Object run(Object[] args) {
int len = ArrayUtils.getLength(args);
if (len == 0) {
return Primitive.ERROR_VALUE;
} else if (len == 1) {
return Math.abs(GeneralUtils.objectToNumber(args[0]).doubleValue());
} else {
FArray<Double> result = new FArray<Double>();
for (Object arg : args) {
result.add(GeneralUtils.objectToNumber(arg).doubleValue());
}
}
return Primitive.ERROR_VALUE;
}
}

17
plugins/pom.xml

@ -0,0 +1,17 @@
<?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>
<parent>
<groupId>com.fr.plugin</groupId>
<artifactId>starter</artifactId>
<version>1.0</version>
</parent>
<packaging>pom</packaging>
<artifactId>plugins</artifactId>
<modules>
<module>plugin-function</module>
</modules>
</project>

3
pom.xml

@ -8,6 +8,9 @@
<properties>
<common-version>10.0-RELEASE-SNAPSHOT</common-version>
</properties>
<modules>
<module>plugins</module>
</modules>
<dependencies>
<!-- core包 -->
<dependency>

Loading…
Cancel
Save