Page 1 of 2

Eclipse and Maven

PostPosted: 23 Jul 2011, 14:04
by friarsol
Since we got the git depot up and running I had been using Eclipse just as I used to. Letting the dependencies try to be handled by Eclipse.

Today I was attempting to run Forge via Maven and was having some issues. It seems like maven build test works just fine, but any other build was having issues.

I ended up needing to follow the directions in the checkmarked answer here: http://stackoverflow.com/questions/2222 ... dk-problem

So this allows me to run maven build install. But when I try to run just a normal maven build, I get an error about not having any goals. My goal is to run forge in debug mode as I used to, and I would guess the option I'm choosing, but it doesn't seem to work the way I expect.

mavenerror | Open
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy, pre-clean, clean, post-clean. -> [Help 1]


It gives me this very unhelpful message and when I open up the properties of maven build and try to select a goal none are available to me. Any help would be appreciated?

Edit: It's possible I'm misunderstanding how maven is used within Eclipse, perhaps the dependency portion it takes care of, but I still run NewGame the same as I used to?

Re: Eclipse and Maven

PostPosted: 23 Jul 2011, 17:08
by Braids
friarsol wrote:. . . Edit: It's possible I'm misunderstanding how maven is used within Eclipse, perhaps the dependency portion it takes care of, but I still run NewGame the same as I used to?
if your Problems view reports no errors, it should work. please report back if it does not.

Re: Eclipse and Maven

PostPosted: 24 Jul 2011, 08:02
by jendave
friarsol wrote:
So this allows me to run maven build install. But when I try to run just a normal maven build, I get an error about not having any goals. My goal is to run forge in debug mode as I used to, and I would guess the option I'm choosing, but it doesn't seem to work the way I expect.
Maven has no default goal. You must give it a goal to run. A "normal" maven build is 'mvn clean install'.

Re: Eclipse and Maven

PostPosted: 24 Jul 2011, 12:28
by Chris H.
A Maven install gave me a forge-1.1.1-SNAPSHOT-jar-with-dependencies.jar and a forge-1.1.1-SNAPSHOT.jar located in the /cardforge/target/ folder. You might be able to copy and paste the forge-1.1.1-SNAPSHOT-jar-with-dependencies.jar, the forge.properties file and the /res/ folder over to a new folder. Move your pics and decks over to this folder. Launch the jar while increasing the java heap space.

It might work for those who were looking for an updated forge to run and test.

A Maven clean will delete the files from the /cardforge/target/ folder.

A Maven build... with the goal clean install gave me what looks like the same results as the Maven install ?

Re: Eclipse and Maven

PostPosted: 24 Jul 2011, 12:59
by Chris H.
A Maven build... with the goal -U -B clean -P osx,windows-linux install gave me what looks like the two archives that are part of our forge beta releases.

Re: Eclipse and Maven

PostPosted: 24 Jul 2011, 17:11
by Rob Cashwalker
I'm working on adding the mantis integration into a clean copy of the repository. It needs a number of dependencies added, but I can't figure out how to actually add dependencies into Maven. The Add Dependency window doesn't do browsing, nor does it explain what I should be putting in there.

Re: Eclipse and Maven

PostPosted: 24 Jul 2011, 20:54
by jendave
One thing that is not intuitive is to execute a maven build from eclipse you use the "Run As..." menu item. That will give you a list of Maven goals to run: install, clean, build etc.

Re: Eclipse and Maven

PostPosted: 24 Jul 2011, 21:08
by Chris H.
jendave wrote:One thing that is not intuitive is to execute a maven build from eclipse you use the "Run As..." menu item. That will give you a list of Maven goals to run: install, clean, build etc.
`
I peeked at the Run Configurations and I see that I have three of them already. Granted, m2 num cardforge (num) is not informative in the Run History. But I guess that I could edit the Name: text box and this would make it easier for me to understand.

Thank you for the heads up. It will take us awhile to figure this out. Do we have a workable build and release goal yet? Will this form work as the goal?

Code: Select all
-U -B clean -P osx,windows-linux install release:clean release:prepare release:perform

Re: Eclipse and Maven

PostPosted: 24 Jul 2011, 21:09
by friarsol
So I guess my main question is: I want to run Forge through the debugger using Maven for dependencies. How do I go about doing that? I have Forge through the debugger working just fine now, I just can't tell if it's using Maven or not.

Re: Eclipse and Maven

PostPosted: 24 Jul 2011, 22:32
by jendave
I have created a new page in the wiki describing full Maven/Git/Eclipse integration.
http://www.slightlymagic.net/wiki/Forge ... ntegration

Please take a look. It is still a little rough.

Dave

Re: Eclipse and Maven

PostPosted: 25 Jul 2011, 00:45
by Rob Cashwalker
I tried this procedure, I got "Invalid remote: origin" while trying to checkout from SCM.

Mind you, the normal git clone has the maven run configs and runs fine... not sure what this process is necessary for.

I'm still trying to figure out the adding of dependencies. I was able to search for "*mantis*" and found a couple libraries, but they're not the ones I'm trying to use, and I can't find documentation on how they're supposed to work. If I sent you the jars that I need can you get them included?

Re: Eclipse and Maven

PostPosted: 25 Jul 2011, 07:35
by jendave
Rob Cashwalker wrote:I tried this procedure, I got "Invalid remote: origin" while trying to checkout from SCM.

Mind you, the normal git clone has the maven run configs and runs fine... not sure what this process is necessary for.

I'm still trying to figure out the adding of dependencies. I was able to search for "*mantis*" and found a couple libraries, but they're not the ones I'm trying to use, and I can't find documentation on how they're supposed to work. If I sent you the jars that I need can you get them included?
When you use the Team menu item, what do you see? I was not seeing the Git commands using the other way, so I did it the way I have in my doc and was able to see both Maven and Git commands in Eclipse menus.

Adding dependencies is fairly straightforward. Double-click on the pom.xml. Eclipse will bring it up in the editor window. Select the "Dependencies" tab in the editor. You can add deps via the buttons.

Not sure about the error you are getting. That usually happens when you do not select the proper remote repo, but that seems unlikely in this case.

Re: Eclipse and Maven

PostPosted: 25 Jul 2011, 13:07
by Rob Cashwalker
The Add Dependencies window expects me to provide fully qualified names.. its not like I can just browse for the local file. I can't find matching libraries for the set of libraries I had downloaded from the MantisConnect project. I can see a number of other libraries that match "mantis" but none are the correct one. One of the ones listed seems like it comes from the correct organization - "biz.futureware.mantis.rpc.soap.client". However they don't have documentation for this particular library, they documented the library I had downloaded from their sourceforge.

With all of the libraries we've added, were all of them already present in Maven?

Re: Eclipse and Maven

PostPosted: 25 Jul 2011, 15:28
by jendave
Rob Cashwalker wrote:The Add Dependencies window expects me to provide fully qualified names.. its not like I can just browse for the local file. I can't find matching libraries for the set of libraries I had downloaded from the MantisConnect project. I can see a number of other libraries that match "mantis" but none are the correct one. One of the ones listed seems like it comes from the correct organization - "biz.futureware.mantis.rpc.soap.client". However they don't have documentation for this particular library, they documented the library I had downloaded from their sourceforge.

With all of the libraries we've added, were all of them already present in Maven?
Please send me the jars. Most of the ones that Forge depends on are on in a standard Maven repo (http://mvnrepository.com), but the ones that were not (jyield), I put into a repo I maintain at http://arcane.googlecode.com/svn/trunk/repository. Since my repo is already a part of the current Forge Maven build, all we have to do is add your mantis jars and we should be good.

Re: Eclipse and Maven

PostPosted: 25 Jul 2011, 18:20
by Rob Cashwalker
Ahh-Hah... I knew there must be a trick like that...