Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /kunden/247608_14469/webseiten/wp-content/themes/wordblab/functions.php on line 28
Warning: Use of undefined constant text - assumed 'text' (this will throw an Error in a future version of PHP) in /kunden/247608_14469/webseiten/wp-content/themes/wordblab/functions.php on line 29
Warning: Use of undefined constant text - assumed 'text' (this will throw an Error in a future version of PHP) in /kunden/247608_14469/webseiten/wp-content/themes/wordblab/functions.php on line 9
Das Einbinden von externen JAR-Bibliotheken in der eigenen JAR ist mit einem Apache Ant Build-Task recht einfach. Für mein Beispiel verweise ich auf dieses Ant Build Skript. Mit nur einer weiteren Zeile (Zeile Nummer 6) kann man die build.xml so erweitern, dass alle externen Bibliotheken aus dem /lib-Verzeichnis in die eigene JAR gepackt werden:
1 2 3 4 5 6 7 | <jar destfile="${jar.dir}/${ant.project.name}-${app.version}.jar" basedir="${classes.dir}"> <manifest> <attribute name="Main-Class" value="${main.class}" /> <attribute name="Class-Path" value="${manifest.class.path}" /> </manifest> <zipgroupfileset dir="${lib.dir}/."/> </jar> |
Das zipgroupfileset
unterstützt alle Attribute des <fileset>
, wodurch über folgenden Befehl einzelne Dateien ausgeschlossen werden können:
1 | <zipgroupfileset dir="${lib.dir}/." excludes="junit-4.8.2.jar" /> |
Für weitere Infos verweise ich auf den Beitrag „NetBeans – deploying all in one jar“ von stackoverflow.
Letzte Kommentare