mirror of
https://github.com/status-im/ethereumj-personal.git
synced 2025-02-26 10:45:12 +00:00
Packaging the application for production structure
This commit is contained in:
parent
28f8fe4101
commit
51d3ed57e3
51
build-post-package.xml
Normal file
51
build-post-package.xml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<project name="enthereumJ-postpackage" default="run" basedir=".">
|
||||||
|
|
||||||
|
<description>
|
||||||
|
simple example build file
|
||||||
|
</description>
|
||||||
|
<!-- set global properties for this build -->
|
||||||
|
<property name="src" location="src"/>
|
||||||
|
<property name="build" location="build"/>
|
||||||
|
<property name="dist" location="dist" />
|
||||||
|
|
||||||
|
|
||||||
|
<target name="init">
|
||||||
|
<!-- Create the time stamp -->
|
||||||
|
<tstamp/>
|
||||||
|
|
||||||
|
<echo message="Ant is taking control [assembly the package]"> </echo>
|
||||||
|
<echo message="${maven.project.artifactId}"> </echo>
|
||||||
|
<echo message="${maven.project.version}"> </echo>
|
||||||
|
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="make-package">
|
||||||
|
|
||||||
|
<mkdir dir="./target/package"/>
|
||||||
|
<copy todir="./target/package/lib">
|
||||||
|
<fileset dir="./target/dependency"/>
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<copy file="./target/${maven.project.artifactId}-${maven.project.version}.jar"
|
||||||
|
tofile="./target/package/ethereumj.jar"/>
|
||||||
|
|
||||||
|
<copy todir="./target/package">
|
||||||
|
<fileset dir="./target/classes/config"/>
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<copy file="./target/classes/log4j.properties" todir="./target/package/config"/>
|
||||||
|
<copy file="./target/classes/system.properties" todir="./target/package/config"/>
|
||||||
|
<copy file="./target/classes/GeoLiteCity.dat" todir="./target/package/config"/>
|
||||||
|
|
||||||
|
|
||||||
|
<zip destfile="ethereumJ-${DSTAMP}-${TSTAMP}.zip" basedir="./target/package">
|
||||||
|
</zip>
|
||||||
|
|
||||||
|
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="run" depends="init, make-package"></target>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
@ -4,18 +4,14 @@
|
|||||||
<groupId>org.ethereum</groupId>
|
<groupId>org.ethereum</groupId>
|
||||||
<artifactId>ethereumj</artifactId>
|
<artifactId>ethereumj</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>0.5.1</version>
|
||||||
<name>EthereumJ</name>
|
<name>EthereumJ</name>
|
||||||
<url>http://www.ethereumj.org</url>
|
<url>http://www.ethereumj.org</url>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
* To deploy all the classes and dependencies to one jar,
|
|
||||||
* that's one option to pack stand alone.
|
|
||||||
mvn clean package dependency:copy-dependencies -Dmaven.test.skip=true
|
|
||||||
|
|
||||||
|
|
||||||
* To deploy the classes in one jar and dependencies to another dir
|
* To deploy the classes in one jar and dependencies to another dir
|
||||||
mvn clean package -Dmaven.test.skip=true
|
mvn clean package -Dmaven.test.skip=true
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -85,6 +81,13 @@ mvn clean package -Dmaven.test.skip=true
|
|||||||
<version>4.1</version>
|
<version>4.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.javassist</groupId>
|
||||||
|
<artifactId>javassist</artifactId>
|
||||||
|
<version>3.15.0-GA</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- remove the real commons-logging from classpath -->
|
<!-- remove the real commons-logging from classpath -->
|
||||||
<!-- declare as provided or exclude from spring jars -->
|
<!-- declare as provided or exclude from spring jars -->
|
||||||
@ -149,25 +152,22 @@ mvn clean package -Dmaven.test.skip=true
|
|||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>2.2.1</version>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
<configuration>
|
<version>2.8</version>
|
||||||
<archive>
|
|
||||||
<manifest>
|
|
||||||
<mainClass>org.ethereum.gui.ToolBar</mainClass>
|
|
||||||
</manifest>
|
|
||||||
</archive>
|
|
||||||
<descriptorRefs>
|
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
|
||||||
</descriptorRefs>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>make-assembly</id>
|
<id>copy-dependencies</id>
|
||||||
<phase>prepare-package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>single</goal>
|
<goal>copy-dependencies</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
|
||||||
|
<overWriteReleases>false</overWriteReleases>
|
||||||
|
<overWriteSnapshots>false</overWriteSnapshots>
|
||||||
|
<overWriteIfNewer>true</overWriteIfNewer>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
@ -185,6 +185,29 @@ mvn clean package -Dmaven.test.skip=true
|
|||||||
</archive>
|
</archive>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
|
||||||
|
<property name="maven.project.artifactId" value="${project.artifactId}"/>
|
||||||
|
<property name="maven.project.version" value="${project.version}"/>
|
||||||
|
<ant antfile="build-post-package.xml" target="run"/>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.ethereum.config;
|
package org.ethereum.config;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
@ -23,12 +25,23 @@ public class SystemProperties {
|
|||||||
|
|
||||||
public SystemProperties() {
|
public SystemProperties() {
|
||||||
try {
|
try {
|
||||||
String filename = "system.properties";
|
|
||||||
input = SystemProperties.class.getClassLoader().getResourceAsStream(filename);
|
File file = null;
|
||||||
if (input == null) {
|
String dir = System.getProperty("user.dir");
|
||||||
logger.warn("Sorry, unable to find " + filename);
|
String fileName = dir + "/config/system.properties";
|
||||||
return;
|
file = new File(fileName);
|
||||||
}
|
|
||||||
|
if (file.exists()){
|
||||||
|
input = new FileInputStream(file);
|
||||||
|
} else{
|
||||||
|
fileName = "system.properties";
|
||||||
|
input = SystemProperties.class.getClassLoader().getResourceAsStream(fileName);
|
||||||
|
if (input == null) {
|
||||||
|
logger.error("Sorry, unable to find " + fileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//load a properties file from class path, inside static method
|
//load a properties file from class path, inside static method
|
||||||
prop.load(input);
|
prop.load(input);
|
||||||
|
|
||||||
@ -70,10 +83,15 @@ public class SystemProperties {
|
|||||||
|
|
||||||
|
|
||||||
public String peerDiscoveryIP(){
|
public String peerDiscoveryIP(){
|
||||||
if(prop.isEmpty()) return "";
|
if(prop.isEmpty()) return "54.201.28.117";
|
||||||
return prop.getProperty("peer.discovery.ip");
|
return prop.getProperty("peer.discovery.ip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int peerDiscoveryPort(){
|
||||||
|
if(prop.isEmpty()) return 30303;
|
||||||
|
return Integer.parseInt(prop.getProperty("peer.discovery.port"));
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
Enumeration<?> e = prop.propertyNames();
|
Enumeration<?> e = prop.propertyNames();
|
||||||
while (e.hasMoreElements()) {
|
while (e.hasMoreElements()) {
|
||||||
|
@ -19,13 +19,16 @@ public class IpGeoDB { // change
|
|||||||
File file = null;
|
File file = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
URL geiIpDBFile = ClassLoader.getSystemResource("GeoLiteCity.dat");
|
|
||||||
file = new File(geiIpDBFile.toURI());
|
|
||||||
} catch (Throwable th) {
|
|
||||||
|
|
||||||
String dir = System.getProperty("user.dir");
|
String dir = System.getProperty("user.dir");
|
||||||
String fileName = dir + "/db/GeoLiteCity.dat";
|
String fileName = dir + "/config/GeoLiteCity.dat";
|
||||||
file = new File(fileName);
|
file = new File(fileName);
|
||||||
|
if (!file.exists()){
|
||||||
|
URL geiIpDBFile = ClassLoader.getSystemResource("GeoLiteCity.dat");
|
||||||
|
file = new File(geiIpDBFile.toURI());
|
||||||
|
}
|
||||||
|
} catch (Throwable th) {
|
||||||
|
th.printStackTrace();
|
||||||
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
cl = new LookupService(file);
|
cl = new LookupService(file);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -235,6 +235,7 @@ class ContractCallDialog extends JDialog implements MessageAwareDialog{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: check up how the HEX value is encoded
|
||||||
Object[] lexaList = msgDataTA.getText().split(",");
|
Object[] lexaList = msgDataTA.getText().split(",");
|
||||||
byte[] data = ByteUtil.encodeDataList(lexaList);
|
byte[] data = ByteUtil.encodeDataList(lexaList);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.ethereum.gui;
|
package org.ethereum.gui;
|
||||||
|
|
||||||
|
import org.apache.log4j.PropertyConfigurator;
|
||||||
import org.ethereum.manager.MainData;
|
import org.ethereum.manager.MainData;
|
||||||
import org.ethereum.util.Utils;
|
import org.ethereum.util.Utils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -18,6 +19,7 @@ import java.awt.event.ItemListener;
|
|||||||
*/
|
*/
|
||||||
public class ToolBar extends JFrame {
|
public class ToolBar extends JFrame {
|
||||||
|
|
||||||
|
|
||||||
Logger logger = LoggerFactory.getLogger(getClass());
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
Logger introLogger = LoggerFactory.getLogger("Intro");
|
Logger introLogger = LoggerFactory.getLogger("Intro");
|
||||||
|
|
||||||
@ -31,10 +33,10 @@ public class ToolBar extends JFrame {
|
|||||||
public ToolBar() throws HeadlessException {
|
public ToolBar() throws HeadlessException {
|
||||||
|
|
||||||
introLogger.info("");
|
introLogger.info("");
|
||||||
introLogger.info("♢ EthereumJ [v0.5.1] by RomanJ");
|
introLogger.info("<> EthereumJ [v0.5.1] by RomanJ");
|
||||||
introLogger.info("♢ Code by Roman Mandeleil, (c) 2014.");
|
introLogger.info("<> Code by Roman Mandeleil, (c) 2014.");
|
||||||
introLogger.info("♢ Contribution: Nick Savers ");
|
introLogger.info("<> Contribution: Nick Savers ");
|
||||||
introLogger.info("♢ Based on a design by Vitalik Buterin.");
|
introLogger.info("<> Based on a design by Vitalik Buterin.");
|
||||||
introLogger.info("");
|
introLogger.info("");
|
||||||
introLogger.info("java.version: " + System.getProperty("java.version"));
|
introLogger.info("java.version: " + System.getProperty("java.version"));
|
||||||
introLogger.info("java.home: " + System.getProperty("java.home"));
|
introLogger.info("java.home: " + System.getProperty("java.home"));
|
||||||
|
@ -51,15 +51,17 @@ public class MainData {
|
|||||||
public MainData() {
|
public MainData() {
|
||||||
|
|
||||||
InetAddress ip = null;
|
InetAddress ip = null;
|
||||||
|
int port = 0;
|
||||||
try {
|
try {
|
||||||
ip = InetAddress.getByName(CONFIG.peerDiscoveryIP());
|
ip = InetAddress.getByName(CONFIG.peerDiscoveryIP());
|
||||||
|
port = CONFIG.peerDiscoveryPort();
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
System.exit(-1);
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerData peer = new PeerData(
|
PeerData peer = new PeerData(
|
||||||
ip.getAddress(), (short) 30303, new byte[]{00});
|
ip.getAddress(), port, new byte[]{00});
|
||||||
peers.add(peer);
|
peers.add(peer);
|
||||||
|
|
||||||
byte[] cowAddr = HashUtil.sha3("cow".getBytes());
|
byte[] cowAddr = HashUtil.sha3("cow".getBytes());
|
||||||
|
@ -19,7 +19,7 @@ public class PeerData {
|
|||||||
private transient boolean isOnline = false;
|
private transient boolean isOnline = false;
|
||||||
private transient long lastCheckTime = 0;
|
private transient long lastCheckTime = 0;
|
||||||
|
|
||||||
public PeerData(byte[] ip, short port, byte[] peerId) {
|
public PeerData(byte[] ip, int port, byte[] peerId) {
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
this.port = port & 0xFFFF;
|
this.port = port & 0xFFFF;
|
||||||
this.peerId = peerId;
|
this.peerId = peerId;
|
||||||
|
2
ethereumj-core/src/main/resources/config/run.bat
Normal file
2
ethereumj-core/src/main/resources/config/run.bat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
call java -Dlog4j.configuration=file:./config/log4j.properties -jar ethereumj.jar
|
||||||
|
pause
|
@ -6,8 +6,9 @@ server.acceptConnections = false
|
|||||||
|
|
||||||
|
|
||||||
# one default access point to start
|
# one default access point to start
|
||||||
# discover the network e.g. [54.201.28.117]
|
# discover the network e.g. ip: [54.201.28.117] port: [30303]
|
||||||
peer.discovery.ip = 54.201.28.117
|
peer.discovery.ip = 54.201.28.117
|
||||||
|
peer.discovery.port = 30303
|
||||||
|
|
||||||
# specify if the mechanism
|
# specify if the mechanism
|
||||||
# to discover more and more
|
# to discover more and more
|
||||||
|
Loading…
x
Reference in New Issue
Block a user