Hi Laszlo, Many thanks for hinting the right direction. I am new to Gradle and I did not understand what I found in the internet and it did not describe my probklem (at least what I thought).
Now, I have made these modifications in the build file: run { classpath += files("${LO_HOME}/program/classes/libreoffice.jar", "${LO_HOME}/program/classes/unoloader.jar") } application { mainClass = mainClassName startScripts { doLast { unixScript.text = unixScript.text .replace('CLASSPATH=$', 'CLASSPATH=$LO_HOME/program/classes/libreoffice.jar:$LO_HOME/program/classes/unoloader.jar:$') windowsScript.text = windowsScript.text .replace('set CLASSPATH=', 'set CLASSPATH=%LO_HOME%\\program\\classes\\libreoffice.jar;%LO_HOME%\\program/classes\\unoloader.jar;') } } } It seems so simple if you have found the solution! I do not know if there is a more elgant way, but it seems to work. Regards Helmut Am 22.08.2020 um 22:53 schrieb Laszlo Kishalmi:
I guess you are using the application Gradle plugin. 1. Remove the runtimeOnly 2. Configure the run task in your Gradle script to add the required jars only when the run task executed. 3. Use the distribution plugin (implicitly includes with application) configuration (https://docs.gradle.org/current/userguide/distribution_plugin.html) to custumize your launcher scripts which could make use of the LO_HOME environment variable. So your distribution with the scripts would be executable as well. On 8/22/20 9:39 AM, Helmut Leininger wrote:Hi, Hopefully, you can give mesome hints how to overcome my problem. I am running Windows 10, Netbeans 12.1 with Gradle 6.6, Java 14. I have a multi-module, multi-project application with Gradle. The important parts of build.gradle: ... apply plugin: 'application' def LO_HOME = 'C:/Program Files/LibreOffice' dependencies { implementation project(':Tools') compileOnly files("${LO_HOME}/program/classes/libreoffice.jar", "${LO_HOME}/program/classes/unoloader.jar") runtimeOnly files("${LO_HOME}/program/classes/libreoffice.jar", "${LO_HOME}/program/classes/unoloader.jar") } application { mainClass = 'LOTestsGradleMulti.Tests.SWriter' } The application runs ok if launched from within Netbeans. So far, so good; But I cannot be executed correctly from the build distribution, because: - the LibreOffice jars (libreoffice.jar, unoloader.jar) must reside in their original location within LibreOffice (otherwise the LO system cannot be found) - for the distribution, the jars are copied into the lib fiolder (where they cannot be used due to the above point) - the classpath in the created execution script set CLASSPATH=%APP_HOME%\lib\Tests.jar;%APP_HOME%\lib\libreoffice.jar;%APP_HOME%\lib\unoloader.jar;%APP_HOME%\lib\Tools.jar I can make it run if I change %APP_HOME%\lib\libreoffice.jar;%APP_HOME%\lib\unoloader.jar; to refer to the correct LibreOffice directory, either by introducing a new variable or fixed path What I would need: - how can I avoid copying the jars to the lib folder ? - how can the classpath created with the correct directory, even better by using a variable ? - still may be run from Netbeans Note: if I remove the runtimeOnly: - the jars are not copied to lib - the classpath still contains the above unusable value - it cannot be run from the IDE any more Thanks in advance Helmut Leininger --------------------------------------------------------------------- To unsubscribe, e-mail:users-unsubscr...@netbeans.apache.org For additional commands, e-mail:users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
<<attachment: h_leininger.vcf>>
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists