Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Deployment with Maven  (Read 2799 times)
0 Members and 1 Guest are viewing this topic.
Offline Gudradain
« Posted 2012-07-08 16:54:17 »

Hello, I'm currently using Maven to deploy a jar on a website. My problem is that the jar name change everytime I upload it. I want to create an html page that link to the jar but it won't work if the name always change. The part that change is the version number (1, 2, 3, 4, 5, etc.) and the date. Here are 2 example of name that Maven created automatically with the command mvn deploy

MiniRunner-0.0.1-20120621.181701-1.jar
MiniRunner-0.0.1-20120705.020026-2.jar
Offline Danny02
« Reply #1 - Posted 2012-07-08 17:53:23 »

Maven 3 now use unique Snapshots as a default, it is normaly a good practice to use unique snapshots.
If you really need ununque snapshots u can use the maven option -DuniqueVersion=false
It may be possible to specifie it in your project pom too.
perhaps:
<uniqueVersion>false</uniqueVersion>
Offline Gudradain
« Reply #2 - Posted 2012-07-08 17:59:15 »

Oh that might just be what I need. I will try it. Smiley

I use Maven to automatically deploy the update to my game. So I don't really need to keep an history of every snapshot. Sometimes I make small update like working 20 minutes. I don't want to have 100 different jars on the website...

Edit : Sproingie seems to be right, I just add the <uniqueVersion>false<uniqueVersion/> in my distribution management block and it doesn't do anything...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie

JGO Kernel


Medals: 202



« Reply #3 - Posted 2012-07-08 18:07:47 »

<uniqueVersion> doesn't work with maven 3, snapshots always have the same pattern now, and m2eclipse depends on it.  You pretty much have to run a job to delete old snapshots before updating the index.  As with all things maven, there's a plugin for that.

http://stackoverflow.com/questions/4275466/how-do-you-deal-with-maven-3-timestamped-snapshots-efficiently
Offline Gudradain
« Reply #4 - Posted 2012-07-08 18:12:35 »

 Shocked Shocked Shocked But why did they do that!!!!

Ok I can get a job to delete old one, but how do I link to the correct one?
Offline sproingie

JGO Kernel


Medals: 202



« Reply #5 - Posted 2012-07-08 18:17:41 »

They did it because snapshot handling in maven 2 was an insane confusing mess that broke all the time.  You shouldn't need to link to the newest snapshot in a filesystem repo -- maven should find it automatically.  If you're deploying to a remote repo, use Nexus to update the index.
Offline Gudradain
« Reply #6 - Posted 2012-07-08 18:31:57 »

Well the only thing that is linking to the newest snapshot is an html page with an <a href> tag. So no, it doesn't find the newest snapshot automatically Cranky

And it's not really my server or my remote repo. It's just a free host server with byethost that I use to upload my file so I have no idea if I can install Nexus on that to update the index...

Right now it feels for me like maven snapshot filehandling is a complete mess. I thought it would be good learning to use Maven just to upload a jar via ftp but it seems that it's impossible to make it simple. Will try simple batch file I guess.

Sorry but I really don't get why they do all that strange stuff.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #7 - Posted 2012-07-08 18:49:29 »

If you're cutting a new version every 20 minutes and need to update a html page that isn't a nexus index or part of the maven site, you're going to have to do that by hand no matter what build tool you use.  With maven, there is of course a plugin to do that sort of thing, but for your byethost page, you might want to just hack something in PHP to look for the latest snapshot and generate the link that way.   (or if a dynamic page is out of the question, what I say below and just use a script to update your public snap rather than dink around doing it with maven)
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2012-07-08 18:50:40 »

Seems like a complex solution for a simple problem.

What are you trying to do:
  • compile source
  • create jars
  • upload with ftp

This is scriptable (.sh/.bat) in a few minutes.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline sproingie

JGO Kernel


Medals: 202



« Reply #9 - Posted 2012-07-08 18:55:29 »

You could write a script per platform or just use maven which does it just fine too.  Honestly tho, the part about uploading a new snap to byethost and generating a link to it, I would also do with a script.  God knows that's easier than screwing with random maven plugins.  There's no rule that says that one repo has to have all the snapshots that are on another, so let your local repo grow as many snapshots as you have builds, then upload the public snap with a script whenever you feel like it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #10 - Posted 2012-07-09 07:52:24 »

They did it because snapshot handling in maven 2 was an insane confusing mess that broke all the time.
I'm quite sure they'll get it right with the third try.

Maven sucks, don't bother.

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #11 - Posted 2012-07-09 07:59:27 »

@Nate: I expected you to plug your own project here, and I didn't want to get in your way.

Seeing that you dropped the ball on that, let me plug it for you.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #12 - Posted 2012-07-09 08:33:38 »

I have to help Nate and Riven on this one, Scar is awesome. I haven't used it much but I tried it once and holy crap it's so straightforward, it's crazy.

Offline sproingie

JGO Kernel


Medals: 202



« Reply #13 - Posted 2012-07-09 16:00:24 »

So how does Scar deal with snapshot dependencies?
Offline gimbal

JGO Knight


Medals: 25



« Reply #14 - Posted 2012-07-09 16:23:55 »

So how does Scar deal with snapshot dependencies?


Its good that you nuanced your retort but now you've reduced it so much that you're missing your original point IMO. This thread is not about Scar, its about getting help with using Maven. Whether you like Maven or not is woefully beside the point - apparently Gudradain does and that's all that matters here.

Now if you'll excuse me, I've got some .NET forums to visit and spam ".NET sucks, Java rules!". Its a hard job but somebody has to do it.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #15 - Posted 2012-07-10 03:33:50 »

This thread is not about Scar, its about getting help with using Maven.

Actually, that was exactly my point too, I just figured I'd point out the inapplicability of the tool rather than righteous flaming over attitudes.  God knows maven can be clunky at times, but it beats dealing with someone's ad-hoc reinvention of it whenever I pick up a new project.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #16 - Posted 2012-07-10 04:50:45 »

This thread is not about Scar, its about getting help with using Maven. Whether you like Maven or not is woefully beside the point - apparently Gudradain does and that's all that matters here.
Ahem. So, somebody it trying to solve a trivial problem, and I strongly get the impression he just picked Maven as a tool. He finds himself in misery, as said tool is fighting him at every step of the way.

Now how can we possibly restrict ourselves to purely answering the question? Aren't we also here to push eachother in the right direction?


Most of the thread here follow a simple pattern:
  • newbie walks in, asks technical question
  • it becomes clear that in his situation, he shouldn't be doing what he's asking for
  • people jump in, explaining what he should do instead
  • newbie actually gets the job done, within a reasonable time frame

Note: I'm not saying Gudradain is a newbie, nor am I saying that my suggestion to use Scar was a great move. I'm just trying to get across that this statement:
apparently Gudradain does and that's all that matters here.
seems a tad odd, but maybe it's just me...

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline sproingie

JGO Kernel


Medals: 202



« Reply #17 - Posted 2012-07-10 05:00:07 »

It might just be entirely possible that Gudradain is using maven for other reasons and not *just* to upload snapshot builds, and thus isn't keen on replacing it with a different tool that doesn't even begin to cover the basic functionality most people use maven for in the first place.

That's at least the assumption I tend to make from the start.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #18 - Posted 2012-07-10 05:03:22 »

Surely that might very well be the case, but when I read his quote, I can't help but feel that these are hist first steps with Maven:

I thought it would be good learning to use Maven just to upload a jar via ftp but it seems that it's impossible to make it simple.

Oh well, it doesn't really matter, Gudradain will be here soon enough to tell us it all worked out, with maven, too - I was merely surprised by the harsh 'answer the question or stfu' post of gimbal.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline sproingie

JGO Kernel


Medals: 202



« Reply #19 - Posted 2012-07-10 05:13:00 »

Deployment is actually a great reason for using maven since it lets you configure the destination in just one place and then all your projects can use it.  I'll grant however that it does defeat the purpose a bit to use it *only* to upload to a non-repository destination with nothing else using it as a dependency.
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #20 - Posted 2012-07-11 02:14:39 »

@Nate: I expected you to plug your own project here, and I didn't want to get in your way.

Seeing that you dropped the ball on that, let me plug it for you.
Not at all. You should know I would never miss a chance to pimp my own projects! Wink Scar doesn't try to replace Maven. Scar is just a hodgepodge collection of utility methods that may be useful if you want to write builds using Java. I might say Scar could replace Ant to build and package Java projects, but Maven is a great big tool that does more, most notably the artifact repositories. Also, AFAIK Scar doesn't have users besides myself, so I wouldn't recommend it to someone who is struggling with Maven, which has an enormous amount of information on Google.

Offline Gudradain
« Reply #21 - Posted 2012-07-13 20:31:40 »

I'm sorry to say it but I stop using maven for uploading via ftp  Emo

I wrote a batch file in 2 minutes and I'm happy ever since...
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #22 - Posted 2012-07-13 21:28:35 »

Haha, that's the spirit! Cheesy

If that is all you wanted...
1  
Scar.ftpUpload(server, user, password, dir, paths, passive);

Happy Riven? :p

Offline Gudradain
« Reply #23 - Posted 2012-07-13 21:36:21 »

Happy Riven? :p

lol
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (24 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56

Norakomi (42 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!