I tried that… firstly in an existing project (==> “unknown property ‘executableDir’”)
Then, in Eclipse, I made a new Gradle project (with the standard directory structure) adding only the Main.java file at that link, and substituing the build.gradle there … exactly the same problem.
BTW my Eclipse (Oxygen) is using Gradle 4.4.1, Groovy 2.4.12 and Java 8
The OS is Windows 10, and the Ant version (as printed when you go “gradle -version”) is 1.9.9
Could any of these be factors involved in the problems I’m having?
NB I also ran at the command line using Groovy 2.6 - same problem.
In fact, if you look at the doc for Project (4.5.1) there doesn’t appear to be a property executableDir
(or a getExecutableDir
method). Is it possible that something else needs to be used now? Such as DEFAULT_BUILD_DIR_NAME
, perhaps …? If so maybe that Github example should be updated…
HOWEVER… in my “real” project, I have succeeded in generating things under /build/install/, namely unzipped bin and lib directories … and yes, running one of the files under /bin/ there runs the project… seemingly using the .jar files under build/install/lib/.
And, using this very useful plug-in I was able to see the effect of including or excluding the ‘application’ plug-in: with it, the build task has 2 additional “dependency tasks” (if that’s the right term… ): ‘distTar’ and ‘distZip’. Is it possible I’m beginning to claw my way to enlightenment? To change the output dir this does the job:
zipDist{
destinationDir = file( "$operativeDir/$version" )
}
I’m slightly puzzled, though. Clearly, when you say “all of the required jars” this means all the dependency jars. But it strikes me that if you have Gradle installed on your system it is clear that you have the dependency jars you need under GRADLE_HOME, and I would expect there to be a way of running gradle from the command line (anywhere) but making use of these existing .jars. Dependency .jars can be huge… to copy the ones that are already present from your local Gradle “single repository” to another place on your system seems a bit strange… I was assuming there would be a way of going (somewhere away from your development location)
gradle -somethingsomething myproject.jar
or
gradlew -somethingsomething myproject.jar
…?