Compiling Maven project in Gradle project on Netbeans

plugins

(Samantha Chan) #1

Hi everyone!

I’m trying to compile a Maven project in Gradle to be included in my Gradle project. I am using the Gradle plugin on Netbeans. With the help of this post, I was able to create tasks that will do just that.

I added /usr/local/netbeans-8.2/java/maven/bin path to the system environment path (permanently by editing the ~/.bashrc file), from which a symbolic link of the mvn file was created in the /usr/bin directory.

Unfortunately, I am unable to compile the project.

Error message on console:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileMavenProject'.
> A problem occurred starting process 'command '/usr/bin/mvn''

Does anyone have any idea why this isn’t compiling?

I gather that I should also try changing the Netbeans and/or Gradle path environment, but I don’t know how to go about doing that.

Any tips or guidance will be greatly appreciated! Thank you in advance for your time.


(spy99) #2

do you need to have maven on your computer? and why would you want to do this anyhow?


(Samantha Chan) #3

I have a project that requires a library that was originally written as a maven project. Unfortunately, I need to make some changes to the library to suit my needs. I read from that post that it is possible to include a maven project into a gradle project using the described method, and it seems to work for many people since there hasn’t been any reported problems with such a method. I don’t understand why it isn’t working for me…

An alternative method would be to copy all the source code into a new gradle project, and create a build.gradle and settings.gradle file from the pom.xml included in the maven project. The final method is to install maven on my computer, make those changes, and recompile the project back into a .jar file to be included in my gradle project. However I am new to maven, and don’t want to mess up the dependencies and settings, and prefer not to have to install maven, so I wanted to see if this method will work before I move on to these other options.