Gudradain
|
 |
«
Posted
2012-07-08 18: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
|
|
|
|
|
Danny02
|
 |
«
Reply #1 - Posted
2012-07-08 19: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>
|
|
|
|
|
Gudradain
|
 |
«
Reply #2 - Posted
2012-07-08 19:59:15 » |
|
Oh that might just be what I need. I will try it.  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!
|
|
|
|
|
|
sproingie
|
 |
«
Reply #5 - Posted
2012-07-08 20: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.
|
|
|
|
|
Gudradain
|
 |
«
Reply #6 - Posted
2012-07-08 20: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  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.
|
|
|
|
|
sproingie
|
 |
«
Reply #7 - Posted
2012-07-08 20: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)
|
|
|
|
|
Riven
|
 |
«
Reply #8 - Posted
2012-07-08 20: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.
|
|
|
|
sproingie
|
 |
«
Reply #9 - Posted
2012-07-08 20: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!
|
|
Nate
|
 |
«
Reply #10 - Posted
2012-07-09 09: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.
|
|
|
|
Riven
|
 |
«
Reply #11 - Posted
2012-07-09 09: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.
|
|
|
|
ra4king
|
 |
«
Reply #12 - Posted
2012-07-09 10: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.
|
|
|
|
sproingie
|
 |
«
Reply #13 - Posted
2012-07-09 18:00:24 » |
|
So how does Scar deal with snapshot dependencies?
|
|
|
|
|
gimbal
|
 |
«
Reply #14 - Posted
2012-07-09 18: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.
|
|
|
|
|
sproingie
|
 |
«
Reply #15 - Posted
2012-07-10 05: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.
|
|
|
|
|
Riven
|
 |
«
Reply #16 - Posted
2012-07-10 06: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...
|
|
|
|
sproingie
|
 |
«
Reply #17 - Posted
2012-07-10 07: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.
|
|
|
|
|
Riven
|
 |
«
Reply #18 - Posted
2012-07-10 07: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.
|
|
|
|
sproingie
|
 |
«
Reply #19 - Posted
2012-07-10 07: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.
|
|
|
|
|
Nate
|
 |
«
Reply #20 - Posted
2012-07-11 04: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!  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.
|
|
|
|
Gudradain
|
 |
«
Reply #21 - Posted
2012-07-13 22:31:40 » |
|
I'm sorry to say it but I stop using maven for uploading via ftp  I wrote a batch file in 2 minutes and I'm happy ever since...
|
|
|
|
|
Nate
|
 |
«
Reply #22 - Posted
2012-07-13 23:28:35 » |
|
Haha, that's the spirit!  If that is all you wanted... 1
| Scar.ftpUpload(server, user, password, dir, paths, passive); |
Happy Riven? :p
|
|
|
|
Gudradain
|
 |
«
Reply #23 - Posted
2012-07-13 23:36:21 » |
|
|
|
|
|
|
|