0
我目前正在使用名爲jsoup-1.10.1
的外部庫的程序。在我開始使用jsoup
jar之前,我已經使用了launch4j
,但是現在我必須使用這個庫,我無法弄清楚如何將jsoup
與我的項目結合起來,這樣我就可以生成可正常工作的exe文件。我已經做了一些關於此事的研究,但似乎沒有任何工作。有什麼建議麼?外部jar /庫launch4j問題
我目前正在使用名爲jsoup-1.10.1
的外部庫的程序。在我開始使用jsoup
jar之前,我已經使用了launch4j
,但是現在我必須使用這個庫,我無法弄清楚如何將jsoup
與我的項目結合起來,這樣我就可以生成可正常工作的exe文件。我已經做了一些關於此事的研究,但似乎沒有任何工作。有什麼建議麼?外部jar /庫launch4j問題
用onejar
創建一個罐子,然後在launch4j
中使用此罐子。
適用於許多外部罐子。只有加載資源可能有點棘手,但是可能的。在pom.xml
例如部分:
<build>
<plugins>
<plugin>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<configuration>
<mainClass>com.xy.Mainclass</mainClass>
<attachToBuild>false</attachToBuild>
<classifier>onejar</classifier>
</configuration>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<jar>${project.build.directory}/${project.artifactId}-${project.version}.one-jar.jar</jar>
<outfile>${project.build.directory}/${project.artifactId}.exe</outfile>
<downloadUrl>http://java.com/download</downloadUrl>
<classPath>
<mainClass>com.simontuffs.onejar.Boot</mainClass>
<preCp>anything</preCp>
</classPath>
<singleInstance>
<mutexName>${project.artifactId}</mutexName>
</singleInstance>
<jre>
<minVersion>1.6.0</minVersion>
<jdkPreference>preferJre</jdkPreference>
<initialHeapSize>128</initialHeapSize>
<maxHeapSize>1024</maxHeapSize>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<copyright>...</copyright>
<productVersion>0.0.0.1</productVersion>
<txtProductVersion>0.0.0.1</txtProductVersion>
<productName>${project.name}</productName>
<companyName>...</companyName>
<internalName>${project.artifactId}</internalName>
<originalFilename>${project.artifactId}.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-exe</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}.exe</file>
<type>exe</type>
<classifier>executable</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
感謝您的建議,但是從我在其網站上挖出來的似乎只與Eclipse項目工作。我正在使用Netbeans。 –
該解決方案適用於任何'maven'項目。你用什麼來構建你的應用程序? 'ant'這意味着你有一個'build.xml'?也許你可以添加更多的數據到你的問題... – bozu
是的,我使用Ant 1.9.4,這有什麼用? –