3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-12 10:15:52 +00:00

Make wallet tool compile to a minimized, bundled JAR so it can be used standalone, and change the wallet-tool script to use it that way. It makes running much faster.

This commit is contained in:
Mike Hearn 2012-04-02 16:13:45 +02:00
parent 628cbb6a1d
commit 0c90081c12
3 changed files with 66 additions and 20 deletions

View File

@ -32,22 +32,62 @@
<name>BitCoinJ Tools</name> <name>BitCoinJ Tools</name>
<description>A collection of useful tools that use the BitCoinJ library to perform wallet operations</description> <description>A collection of useful tools that use the BitCoinJ library to perform wallet operations</description>
<dependencies> <build>
<dependency> <plugins>
<groupId>com.google</groupId> <plugin>
<artifactId>bitcoinj</artifactId> <groupId>org.apache.maven.plugins</groupId>
<version>${project.parent.version}</version> <artifactId>maven-shade-plugin</artifactId>
</dependency> <version>1.6</version>
<dependency> <configuration>
<groupId>net.sf.jopt-simple</groupId> <excludes>
<artifactId>jopt-simple</artifactId> <!-- bundle all JARs -->
<version>4.3</version> </excludes>
</dependency> <!-- Remove dead classes -->
<dependency> <minimizeJar>true</minimizeJar>
<groupId>org.slf4j</groupId> <filters>
<artifactId>slf4j-jdk14</artifactId> <filter>
<version>1.6.4</version> <!-- exclude signatures, the bundling process breaks them for some reason -->
</dependency> <artifact>*:*</artifact>
</dependencies> <excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.google.bitcoin.tools.WalletTool</mainClass>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google</groupId>
<artifactId>bitcoinj</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
</project> </project>

View File

@ -40,7 +40,6 @@ import java.util.logging.LogManager;
/** /**
* A command line tool for manipulating wallets and working with Bitcoin.<p> * A command line tool for manipulating wallets and working with Bitcoin.<p>
*
*/ */
public class WalletTool { public class WalletTool {
private static final Logger log = LoggerFactory.getLogger(WalletTool.class); private static final Logger log = LoggerFactory.getLogger(WalletTool.class);

View File

@ -1,2 +1,9 @@
#!/bin/sh #!/bin/bash
mvn -q exec:java -Dexec.mainClass=WalletTool -Dexec.args="$*"
# Check if the jar has been built.
if [ ! -e target/bitcoinj-tools-*.jar ]; then
echo "Compiling WalletTool to a JAR"
mvn -q package -DskipTests
fi
java -jar target/bitcoinj-tools-*.jar $*