hi all,

i've just had a need for the ODF validator, tried to build it from
source and failed miserably.  using "mvn install" i got some weird JEE
.war thing, a .jar file with the sources (the point of which escapes
me), and a validator-with-all-dependencies.jar file.  the latter looked
promising until it became apparent that it didn't, uhmmm, include the
actual validator classes, so it didn't run.

attached is my attempt to fix this; i failed to somehow add extra files
to the existing "assembly" thing so just copied its definition from the
maven website and added the target/classes, which seems to work but is
likely not the best way to do this (please note that i know absolutely
nothing about maven).

one annoyance i have with the maven build is that it appears to download
the ODF schemas from the OASIS site over and over again on every "mvn
install", never noticing that they already exist on the filesystem.  i
remember a time when the validator was built with ant when that didn't
happen.  well back then one had to download all schemas once manually
which is hardly convenient, but subsequent builds were much faster.

also i've noticed the lack of a .gitignore hence the second patch.

regards,
 michael

From 02005c88733d4c295f5ca4c9ec3b48e5eb26bdb7 Mon Sep 17 00:00:00 2001
From: Michael Stahl <[email protected]>
Date: Wed, 12 Sep 2012 18:17:50 +0200
Subject: [PATCH 1/2] validator: create jar-with-dependencies that actually
 runs:

- include validator classes in jar-with-dependencies
- set the manifest main class
---
 validator/jar-with-dependencies.xml |   27 +++++++++++++++++++++++++++
 validator/pom.xml                   |    9 ++++++---
 2 files changed, 33 insertions(+), 3 deletions(-)
 create mode 100644 validator/jar-with-dependencies.xml

diff --git a/validator/jar-with-dependencies.xml b/validator/jar-with-dependencies.xml
new file mode 100644
index 0000000..683d854
--- /dev/null
+++ b/validator/jar-with-dependencies.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd";>
+  <!-- TODO: a jarjar format would be better -->
+  <id>jar-with-dependencies</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory>/</outputDirectory>
+      <useProjectArtifact>true</useProjectArtifact>
+      <unpack>true</unpack>
+      <scope>runtime</scope>
+    </dependencySet>
+  </dependencySets>
+  <!-- customization: add classes (wtf isn't this included by default?) -->
+  <fileSets>
+    <fileSet>
+      <outputDirectory>/</outputDirectory>
+      <directory>${basedir}/target/classes</directory>
+      <useDefaultExcludes>true</useDefaultExcludes>
+    </fileSet>
+  </fileSets>
+</assembly>
diff --git a/validator/pom.xml b/validator/pom.xml
index ba28ba0..03cfcd2 100644
--- a/validator/pom.xml
+++ b/validator/pom.xml
@@ -308,9 +308,12 @@
 			<plugin>
 				<artifactId>maven-assembly-plugin</artifactId>
 				<configuration>
-					<descriptorRefs>
-						<descriptorRef>jar-with-dependencies</descriptorRef>
-					</descriptorRefs>
+					<archive>
+						<manifest>
+							<mainClass>org.odftoolkit.odfvalidator.Main</mainClass>
+						</manifest>
+					</archive>
+					<descriptor>${basedir}/jar-with-dependencies.xml</descriptor>
 				</configuration>
 				<executions>
 					<execution>
-- 
1.7.7.6

>From d84155e9a2f7827229667260045df29d29d1f97a Mon Sep 17 00:00:00 2001
From: Michael Stahl <[email protected]>
Date: Wed, 12 Sep 2012 18:29:01 +0200
Subject: [PATCH 2/2] add .gitignore

---
 .gitignore |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..aaba68a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+*~
+.*sw?
+\#*
+.DS_Store
+
+target/
-- 
1.7.7.6


Reply via email to