1

I am new in java/gradle. I checked several simple tutorials about Gradle but I need to run a more complicated package that contains gradle directory structure. I imported https://github.com/lklee9/DriftMapper project zip file. I followed instruction points

1- Run the gradle task "fatJar"

using the command shell I changed the directory to driftanalyse (a subdirectory of the DriftMapper) and execute the command:

gradle fatJar

The output: A problem occurred evaluating root project 'driftanalyse'. Could not find method compile() for arguments [{group=nz.ac.waikato.cms.moa, name=moa, version=2016.04}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

The imported project applies the old version of Gradle 3.3. It is no problem because the folder contained Gradle wrapper.

.\gradlew fatJar

The output:

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

In the second section of the instruction entitled Data Mapper we can read that "A copy of the fatJar of DriftAnalyse is already added in "datamapper/lib" but I cannot execute this file (java -jar path) - maybe it doesn't make sense.

Next, I followed instruction points for Data Mapper:

1- Open a terminal in the directory "datamapper"

2- run the command "sbt" or "sbt.bat" in windows

The output:

Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

Error: Could not find or load main class xsbt.boot.Boot

EDIT:

Attempting to build on the driftanalyse in NetBeans gives the following message:

Unexpected exception; Priority SILENT, Category: Error

"The version of Gradle you are using (3.3) does not support the environment variables customization feature. Support for this is available in Gradle 3.5 and all later versions."

So, in the Tools-Options-Java-Gradle I changed the Gradle version to 3.5 and unchecked the box "Prefer to use Gradle Wrapper...". Now, we can see on the list of project files new input: Configuration containing the compile and testCompile files. Next, I attempted to build the driftanalyse - meanwhile I received the Windows Defender info window that Defender blocked the java functionality. I agreed to allow java into the system and surprisingly, the Netbeans building task was completed successfully.

EDIT2

How to get a similar effect using the command line?

This part (driftanalyse) of the project is not GUI based. I removed Gradle 7.4 from the installation folder and inserted Gradle 3.5. (Probably the command

gradle wrapper --gradle -version 3.5

will do the same). The command "gradle fatJar" initiated the build process. (The Windows Defender asked for permission for the JAVA again).

Oops, we have another problem: Build failed with an exception. Execution failed for task ':compileJava'. Could not find tools.jar.

I created a new environment variable JAVA_HOME according to Gradle does not find tools.jar. Now, the Gradle building process was successful. But, there is no main manifest attribute for the generated driftanalyse-1.0-all.jar file.

To start the GUI for this project, I installed recent sbt-1.6.2. Now, the sbt worked properly. I ran the command "run" in the sbt prompt. It looks like the process finalized successfully and the application works fine in localhost:9000 in the browser.

tomek
  • 81
  • 5

0 Answers0