4 ms·
It's long been ironic that Java has excellent dependency management in the form of Maven - better than any other tool I've used, for any language - but the typi
by lmm 11y ago
It's long been ironic that Java has excellent dependency management in the form of Maven - better than any other tool I've used, for any language - but the typical java project had far fewer dependencies than in ruby or node. Glad to see some smaller libraries emerging (and it's worth noting that even e.g. spring is now released as a collection of smaller modules rather than one giant jar).
- creshal 11y agoI'm dabbling with Java occasionally, and what always stumps me is that dependencies are handled differently in every environment. Learning how to add and use an external library in Android is too painful, and zero of that knowledge transfers to Java desktop applications, and zero of that to JBoss WARs. At some point I just give up and start copy pasting source files; Java's whole environment is too painful for me to want to spend my free time on it, and too complex to learn it in passing at work. It's a lose-lose situation, and I just end up avoiding Java where I can. (Which imo is a shame, because JBoss e.g. turned out to be surprisingly neat once I wrapped my head around it.)
- lmm 11y agoWell there are a bunch of things that are not really Java and it's best to just avoid them; that's not really Java's fault though. I'm not sure what you're talking about with android versus desktop applications though; in android or a desktop application one adds a library as a maven dependency in exactly the same way. (At least, I do).
- creshal 11y ago> Well there are a bunch of things that are not really Java and it's best to just avoid them I've only ever heard that of Java and C++, and it seems it's always the stuff I cannot avoid because I need it for work.
- maaaats 11y agoYour complaint basically boils down to "I don't know how to do it correctly and don't want to learn it". I have a game I'm working on that uses the same setup for both Android and desktop. JBoss does things a crazy way, but for everything else the same approach can be used.
- ibejoeb 11y agoYou're doing a bunch of different things there, but none of this stuff is really a secret. You need to be familiar with java class loading[1] and Maven's dependency scopes[2], which is really it's killer feature. Beyond that, a container, such as jboss, is free define how its things work. One of my favorite things to come out of the Java ecosystem is OSGi, which does dependency management in a very sane way. [1] http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html http://docs.oracle.com/javase/8/docs/technotes/tools/finding... [2] https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope https://maven.apache.org/guides/introduction/introduction-to...
- _lce0 11y agoIt's undeniable that maven can do much more things that other dependency managers, like setting IDE configurations for instance, but that does not make it better. Do you think it's better than the likes of npm, bower, or composer? where you just say: give me all these things, with at least these versions, and could you please run these scripts also --all at once, in about 30 lines Every time I want to use mvn I need to start for google .. which was the archetype parameter that I needed? or so let's run this not-so-common target, no problem I have 5 minutes for a coffee while it downloads all the requirements .. then 5 minutes later says "missing parameter"
- lmm 11y ago> Do you think it's better than the likes of npm, bower, or composer? where you just say: give me all these things, with at least these versions, and could you please run these scripts also --all at once, in about 30 lines of plain text. Yes. "Run these scripts" leads to snowflake builds: every project ends up slightly different from every other, no-one can resist putting a little "magic" in their build that then goes on to confuse future developers. Requiring every build step to be encapsulated as a plugin, so that there's one and only one way of putting the scm version in your build, one and only one way of bundling your app into an executable, and so on, makes everything much more maintainable. > Every time I want to use mvn I need to start for google .. which was the archetype parameter that I needed? You don't need archetypes if you find them problematic. Just start with a minimal pom: groupId, applicationId and version. That's not so hard is it? > or so let's run this not-so-common target, no problem I have 5 minutes for a coffee while it downloads all the requirements .. then 5 minutes later says "missing parameter" Either you share your build steps, which means downloading them sometimes, or you copy/paste them everywhere. I know which I prefer. Maven caches quite aggressively (if anything too aggressively), I'm not sure what more it could do.
- jjnoakes 11y agoRunning scripts doesn't imply "snowflake builds" - one can just as easily write duplicate plugins that are a mess, and one can also just as easily write encapsulated scripts that do one job and do it well. It's all about the quality of the developers.
- ExpiredLink 11y agoIf you are using Standard Java EE you have exactly one dependency in your pom file.
- vbezhenar 11y agoThat's interesting. I'm the person who don't like external libraries and avoids using them unless they are really make me happy. Yet my last small project has 89 libraries in dependencies (including transitive). Is it small number?
- jimrandomh 11y agoMy own experiences with Maven have been kind of nightmarish. It puts so much abstraction in between what you see and the underlying reality of command-line tool invocations that it becomes impossible to debug. It also improperly mixes compiling and downloading dependencies into a single tool - more than once I've checked out a project and started compiling it and immediately hit ^C when I noticed it was downloading software without https.
- haddr 11y agoWith maven it's a bit like with sex: the first time is sometimes not that funny, and rather painful. And if you're boy you might have not delivered 100% what was expected.
- lmm 11y ago> It puts so much abstraction in between what you see and the underlying reality of command-line tool invocations that it becomes impossible to debug. That's not the reality. The reality is plugins which are java code - and if you're developing a java program you ought to be capable of debugging java code. > It also improperly mixes compiling and downloading dependencies into a single tool "improper" is like "unprofessional" - it's not a real criticism. Having a single command to build is very valuable.
- jimrandomh 11y agoMy own experiences with Maven have been kind of nightmarish. It puts so much abstraction in between what you see and the underlying reality of command-line tool invocations that it becomes impossible to debug. It also improperly mixes compiling and downloading dependencies into a single tool - more than once I've checked out a project and started compiling it and immediately hit ^C when I noticed it was downloading software without https.