Skip to content

Commit

Permalink
done with assembly; done with shell
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Jan 11, 2018
1 parent 3f29a19 commit 317b509
Show file tree
Hide file tree
Showing 10 changed files with 454 additions and 339 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ target/
test-output

# local test
pard-server-test/
pard-main/etc/distribute.sh
pard-main/etc/pid
pard-main/etc/test.sql
23 changes: 23 additions & 0 deletions pard-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,27 @@
<properties>
<main.basedir>${project.parent.basedir}</main.basedir>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/pard-final.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
29 changes: 27 additions & 2 deletions pard-assembly/src/main/assembly/pard-final.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,40 @@
<id>final</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
<format>dir</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>pard-1.0-snapshot</baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/../pard-server-test</directory>
<outputDirectory>/bin</outputDirectory>
<directory>${project.basedir}/../pard-main/etc/sbin</directory>
<outputDirectory>sbin</outputDirectory>
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
</fileSet>
<fileSet>
<directory>${project.basedir}/../pard-main/src/main/resources/webapp</directory>
<outputDirectory>webapp</outputDirectory>
</fileSet>
</fileSets>

<files>
<file>
<source>${project.basedir}/../pard-main/target/pard-server.jar</source>
<outputDirectory>bin</outputDirectory>
</file>
<file>
<source>${project.basedir}/../pard-client/target/pard-client.jar</source>
<outputDirectory>bin</outputDirectory>
</file>
<file>
<source>${project.basedir}/../pard-main/etc/pard.properties</source>
<outputDirectory></outputDirectory>
</file>
<file>
<source>${project.basedir}/../pard-main/etc/jvm.properties</source>
<outputDirectory></outputDirectory>
</file>
</files>
</assembly>
1 change: 0 additions & 1 deletion pard-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<mainClass>cn.edu.ruc.iir.pard.client.PardClient</mainClass>
</transformer>
</transformers>
<outputDirectory>${main.basedir}/pard-server-test/</outputDirectory>
</configuration>
</execution>
</executions>
Expand Down
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions pard-main/etc/sbin/pard-client
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

if [ $# != 2 ] ; then
echo "pard-client <host> <port>"
exit
fi

cd `dirname $0`

exec java -jar ../bin/pard-client.jar $1 $2
51 changes: 51 additions & 0 deletions pard-main/etc/sbin/pard-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

if [ $# != 1 ] ; then
echo "pard-server <run/start/stop>"
exit
fi

cd `dirname $0`

# run in foreground
if [ $1 == "run" ] ; then
if [ -e ../pid ] ; then
echo "Pard already started. Please stop it first."
else
exec java -jar ../bin/pard-server.jar ../pard.properties
fi
exit
fi

# run in background
if [ $1 == "start" ] ; then
if [ -e ../pid ] ; then
echo "Pard already started. Please stop it first."
else
nohup java -jar ../bin/pard-server.jar ../pard.properties &
pid=$!
echo ${pid} > ../pid
echo "Pard is running in background as" ${pid}
fi
exit
fi

# stop
if [ $1 == "stop" ]
then
if [ -e ../pid ] && [ -r ../pid ] ; then
# read pid
pid=$(head -n 1 ../pid)
# kill process
kill -9 ${pid}
# remove file
rm ../pid
echo "Pard at" ${pid} "is killed."
else
echo "Pard is not started yet."
fi
exit
fi

echo "pard-server <run/start/stop>"
exit
221 changes: 110 additions & 111 deletions pard-main/pom.xml
Original file line number Diff line number Diff line change
@@ -1,119 +1,118 @@
<?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>pard</artifactId>
<groupId>cn.edu.ruc.iir</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pard</artifactId>
<groupId>cn.edu.ruc.iir</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>pard-main</artifactId>
<artifactId>pard-main</artifactId>

<properties>
<main.basedir>${project.parent.basedir}</main.basedir>
</properties>
<properties>
<main.basedir>${project.parent.basedir}</main.basedir>
</properties>

<dependencies>
<!-- pard -->
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-commons</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-communication</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-parser</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-catalog</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-connector-postgresql</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-nodekeeper</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-optimizer</artifactId>
</dependency>
<!-- grpc -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
</dependency>
<!-- marshalling -->
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-serial</artifactId>
</dependency>
<dependencies>
<!-- pard -->
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-commons</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-communication</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-parser</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-catalog</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-connector-postgresql</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-nodekeeper</artifactId>
</dependency>
<dependency>
<groupId>cn.edu.ruc.iir</groupId>
<artifactId>pard-optimizer</artifactId>
</dependency>
<!-- grpc -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
</dependency>
<!-- marshalling -->
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-serial</artifactId>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<!-- jetty -->
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<version>9.2.14.v20151106</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>9.2.15.v20160210</version>
</dependency>
</dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<!-- jetty -->
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<version>9.2.14.v20151106</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>9.2.15.v20160210</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>pard-server</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>allinone</shadedClassifierName>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INT/*.DSA</exclude>
<exclude>META-INT/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>cn.edu.ruc.iir.pard.server.PardServer</mainClass>
</transformer>
</transformers>
<outputDirectory>${main.basedir}/pard-server-test/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>pard-server</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>allinone</shadedClassifierName>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INT/*.DSA</exclude>
<exclude>META-INT/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>cn.edu.ruc.iir.pard.server.PardServer</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 317b509

Please sign in to comment.