Gudradain
|
 |
«
Posted
2012-06-21 12:49:56 » |
|
Hello,
I have a game I'm working on currently and I would like to make a lot of quick updates to it. The game is still in it's infancy but I would like to build it in front of the public. For example, some days I would be working on it 30 minutes but I would like to make those 30 minutes of work available for testing right away.
Currently, publishing something takes me a while. I'm working with eclipse. What I usually do is put all my classes files in some place with the resources, go with command line to that place build the jar specifying the entry point. Log into my ftp account, select the jar and upload it to my web site. And I write a simple applet tag for my website. It's not that long but it still takes a few minutes and it's boring work.
Is there a better/faster way to do it?
Recently I heard about Gradle and took a quick glance at it. It seems to be the thing that I need to build my jar and upload it in 1 click. Am-I right?
|
|
|
|
Regenuluz
|
 |
«
Reply #1 - Posted
2012-06-21 12:55:12 » |
|
Well, Eclipse can build the Jar file for you. Under "File"->"Export" select runnable jar, for a standalone jar file, or just jar if you use it as an applet. Or else you could probably write a script that does all of the work for you. 
|
|
|
|
Orangy Tang
|
 |
«
Reply #2 - Posted
2012-06-21 12:56:24 » |
|
Is there a better/faster way to do it?
Yes, make yourself an Ant build script that can compile, jar and upload your game in a single task. Then it's a one-click operation. Eclipse has Ant support built in so you can run it within Eclipse as well. Someone will probably be along in a moment to suggest you use Maven instead, which is essentially the same thing but more complicated. 
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Danny02
|
 |
«
Reply #3 - Posted
2012-06-21 13:21:54 » |
|
Is there a better/faster way to do it?
Yes, make yourself an Ant build script that can compile, jar and upload your game in a single task. Then it's a one-click operation. Eclipse has Ant support built in so you can run it within Eclipse as well. Someone will probably be along in a moment to suggest you use Maven instead, which is essentially the same thing but more complicated.  sry Orangy Tang, but can there be something more complicated then ANT? with ANT one have to programm huge script files to do basic stuff, with maven you copy past 3 lines and change some parameters and you get a build which packs all dependencie together, zip, pack, sign and upload them to your ftp MAVEN!!!!
|
|
|
|
Gudradain
|
 |
«
Reply #4 - Posted
2012-06-21 14:24:51 » |
|
Well currently I don't Ant or Maven so both look complicated  Is an ftp account enough to automatically upload something with Ant or Maven?
|
|
|
|
|
impaler
Senior Newbie 
|
 |
«
Reply #6 - Posted
2012-06-21 15:16:05 » |
|
Spending even half a day on learning something like this will pay off big time! Not just on your hobby projects but pretty much in any job you will get as a software developer you will need to use these. Also laziness is one of the 3 virtues remember? http://c2.com/cgi/wiki?LazinessImpatienceHubrisNow be lazy and write a script that will do that for you!
|
|
|
|
sproingie
|
 |
«
Reply #7 - Posted
2012-06-21 15:19:41 » |
|
|
|
|
|
Gudradain
|
 |
«
Reply #8 - Posted
2012-06-21 15:56:57 » |
|
Hmmm, but how do you use Maven with Eclipse? Do you need to create the project with Maven first then you create an eclipse project with Eclipse then you link to the source of the Maven Project?
Edit : It seems to work that way. But could you do it the other way around? Creating eclipse project first then adding the POM.xml file?
|
|
|
|
impaler
Senior Newbie 
|
 |
«
Reply #9 - Posted
2012-06-21 16:05:52 » |
|
You can use the maven eclipse plugin. http://www.sonatype.org/m2eclipseAll you need is a pom.xml file and you can right click in eclipse on the project and pick Maven -> Enable or something similar and there you have it. Even without having it in eclipse, you would need to write at the prompt: mvn deploy That's it.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
sproingie
|
 |
«
Reply #10 - Posted
2012-06-21 16:38:50 » |
|
You're not going to want to overlay maven onto an existing eclipse project, since that'd not only force you to write a POM from scratch, you'd also have to override all the directory layouts. Just install the plugin from the eclipse marketplace (search for "maven"), restart eclipse, then when you create a new project, pick "Maven Project".
You can run goals from eclipse using the maven window, but I tend to use the command line for stuff that isn't build or test related.
|
|
|
|
Damocles
|
 |
«
Reply #11 - Posted
2012-06-21 17:16:06 » |
|
Why not write a simple batch script?
I never understand this fuzz with ant for small Projects. Its fine when you have experience in ant anyhow or for a colaborative project, but why use something complicated when you just want some build-commands to be executed linearily.
|
|
|
|
impaler
Senior Newbie 
|
 |
«
Reply #12 - Posted
2012-06-21 17:31:11 » |
|
Isn't this what Ant is doing? Just instead of shell scripting, one writes in XML.
For what is needed here, 2 commands in a shell-script suffice though...
|
|
|
|
Gudradain
|
 |
«
Reply #13 - Posted
2012-06-21 17:32:19 » |
|
I guess it's good learning  OK, maven setup and it build an executable jar file when I type mvn package in command prompt. Is there a faster way to do it using the eclipse plugin? Now, I'm stuck on deployment. http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ftp.htmlIt says that you need to add something in your Setting.xml file but I don't have a Setting.xml file? Do I just create one in my project next to the pom.xml file? Edit : Or does it just say to put a tag <settings> into your pom.xml file?
|
|
|
|
impaler
Senior Newbie 
|
 |
«
Reply #14 - Posted
2012-06-21 17:47:53 » |
|
The settings.xml file is your maven configuration. It can be found in your HOME_DIRECTORY/.m2/settings.xml If you're on windows is c:\Users\<you>\m2\settings.xml (win 7) c:\Documents and Settings\<you>\m2\settings.xml (XP and 2003) For unix systems is ~/.m2/settings.xml More on the settings.xml can be found here: http://maven.apache.org/settings.html but I wouldn't worry too much about reading it.
|
|
|
|
Gudradain
|
 |
«
Reply #15 - Posted
2012-06-21 17:58:49 » |
|
I found a settings.xml file in the conf folder. I guess it's that one! Can I change the name ftp-repository for what I want here? 1 2 3 4 5 6
| <distributionManagement> <repository> <id>ftp-repository</id> <url>ftp: </repository> </distributionManagement> |
Edit : yes I can...
|
|
|
|
Gudradain
|
 |
«
Reply #16 - Posted
2012-06-21 18:21:51 » |
|
Thx for the help everyone. Everything is setup and work 
|
|
|
|
sproingie
|
 |
«
Reply #17 - Posted
2012-06-22 02:13:53 » |
|
I found a settings.xml file in the conf folder. I guess it's that one!
Can I change the name ftp-repository for what I want here?
Those are your global settings that affect every project using that installation of maven. You can put it there, and it does make sense to put some deployment stuff there, but otherwise most stuff should go in pom.xml instead.
|
|
|
|
|