MappedObject library

Knock yourselves out guys! :slight_smile:


<project ...>

	<repositories>

		<repository>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>always</updatePolicy>
				<checksumPolicy>fail</checksumPolicy>
			</releases>
			<id>net.indiespot</id>
			<name>MappedObjectLib</name>
			<url>http://indiespot.net/files/mappedobjectlib/maven2/</url>
			<layout>default</layout>
		</repository>

	</repositories>


	<dependencies>

		<dependency>
			<groupId>net.indiespot</groupId>
			<artifactId>MappedObjectLib</artifactId>
			<version>0.8.5</version>
		</dependency>

	</dependencies>

</project>


Itā€™s not too bad, Iā€™ve drunk the Maven cool-aid and although it infects everything you do, I donā€™t find Iā€™m bothered by it.

Oh no, you start to used maven too :o

My public repository is basically a massive hack: generating a dummy JAR from dummy sourcecode, then replacing the JAR Eclipse generated and I obfuscated, then injecting the required Maven META-INF entries into the JAR, rehashing the *.jar.md5 and *.jar.sha1, then uploading the entire repo to a dir on my webserver.

All that, in a nifty .bat .sh file :-X

Legal note: If the codebase is GPLed, the you should explicitly state what the license is for any AOT outputā€¦assuming that the AOT can run without the library.

Iā€™ll have to rethink the licenses for a bit (donā€™t hold your breath)

BTW:
JIT & AOT cannot run without the library, as mapped types extend types from within the library.

As the author you just need to state what the license rules areā€¦but you should explicitly state them. So youā€™d need to state that class files and generated code is BSD or whatever. This opens up a can of worms however. Consider that using a reverse engineering tools of BSD licensed .class files is a ā€œderived worksā€ of the .class files and so logically BSD licensed, so defeating youā€™re purpose. You could add an exception clause, but Iā€™d guess that would be deemed to be unenforceable. Iā€™d suggest that you GPL everything and get the GPL taint and state that other licensing options are available from the original authorā€¦if youā€™re willing to deal with the generated emails. You could always drop to a less restrictive license in the future if that becomes too much of a PITA.

NOTE: Iā€™m not a lawyer so take this for what itā€™s worthā€¦which isnā€™t much.

Haha! Amen brother!

I reworked it to this simple procedure:
[x] take your mylib-{version}.jar
[x] inject some META-INF entire in your JAR (take previous entries and replace the version string in those)
[x] generate a mylib-{version}.pom (take previous POM and replace version string)
[x] md5sum mylib-{version}.jar
[x] sha1sum mylib-{version}.jar
[x] md5sum mylib-{version}.pom
[x] sha1sum mylib-{version}.pom
[x] dump in some online folder that you defined in your dependencies

(yes, this really is the simplified method, and iā€™m now investigating maven install-file for funzies)

My attempt at thread derailment: Maven is a symptom of everything wrong with software development in the modern age :slight_smile: And as an aside: Project Jigsaw - solving a problem nobody has any more, in the most complicated way possible, so that they have failed to deliver what nearly everyone asked for 10 years ago that only took a couple of hours for an amateur to implement. Way to go, software engineers. The same guys probably invented Maven.

Cas :slight_smile:

In theory: Jigsaw coupled with the proposed (and AFIK unspecified) lightweight native interface should could be very interestingā€¦too bad weā€™re not going to see it soon.

I know that you arenā€™t so fond of all these software design stuff and so on cas, but not everybody is writing only tiny little 1k loc mini games in the world. All this practices which evolved over time might be to big or complicated for some projects, but the nearly all have good ideas behind them. And I would even say that one should start to use them as early as possible.
I get when riven donā€™t want to go through all the hassle to set things up, but it would be a small price to pay to make it for a lot of people easier.

To finish things up, wtf are you talking about maven???
There are alternatives to maven like grandle ā€¦ which I did not try yet, but overall it just makes the hole project live-cycle management so much easier. One might have to read 1-2 pages and try it once to understand the basics, but it is just so much easier to use then any other available tool + all the new positive aspects it brings with it.

So that was my little rant for all the ā€œconservativeā€ guys here.

You seem to imply with your statement that I write tiny 1kloc games. (kloc? who uses that metric any more?)

For your amusement - Revenge of the Titans for example is ~151 kloc excluding the new online stuff weā€™re working on.

Cas :slight_smile:

Well, when I think about maven I always have the same question in mind : ''Why was Maven invented?"

I read here and there that it makes your project lifecycle a lot easier and it can replace ant, and that ant build are a pain to maintain and that it slow down your project velocity and etc.

But really, what does Maven do that I canā€™t do with Eclipse + a few mouse click + some .bat files?

Not require the .bat files. Want to add a dependency on commons-io? Type FileUtils in an editor in eclipse. It gets redlined because it doesnā€™t know what that is. Right click it, say ā€œsearch for maven dependencyā€ (or whatever it says in eclipse these days). Find commons-io in the list. It will download it, the source and javadoc (optionally), add it to your compile and run classpath, and the same for anything it depends on.

All clicky. No XML.

Oh but right, REAL MEN do it all by hand. Whatevs.

So is that the reason why Maven was invented?

I will assume that for now. Something like that is really a good thing. I would want something that could manage all the external jar I need for my project without having to go download them by hand and that would update the jar for the newest version when I want. That would be really useful for sure. But why doesnā€™t maven only do that? Or is there any plugin or tool out there that only do that?

I donā€™t want maven to create my eclipse project. Eclipse can do it.
I donā€™t want maven to build my jar. Eclipse can do it.
I donā€™t want maven to run my test. Eclipse can do it.

I mean why did they tried to make 1 tool do everything and even worse force you to do everything with that tool? Nobody want thatā€¦ Everyone like to work his own way.

My question stand, why was maven invented? To force you to do everything with it or to give you the opportunity to automatically download all the jars you need for your project to run?

Dependency management is a big reason for Mavenā€™s existence, yes. It also does quite a few other things.

As for the preference for eclipse, fine. If you prefer eclipseā€™s layout, change them from the defaults. No one is ā€œforcingā€ you to use it at all, let alone use every last feature of it. Perhaps you should reserve your remaining criticisms of maven until youā€™ve learned more about it

Wait, I made a public maven repository, I thought by doing that I actually went through the hassle - believe me, it was. And now you insinuate I didnā€™t bother.

Anyways, Iā€™m willing to tolerate even more of a derailment than this! Iā€™d appreciate it though if we could also discuss mapped objects, while weā€™re at it. :slight_smile:

Iā€™m currently entertaining the idea of making a block-world kind of test game using MappedObjects, where I would have a Block class thatā€™s a MappedType. No, not minecraft.
Give me a week to get back to my computer though.

You didnā€™t go through the hassle of getting your library hosted on the Maven central repository (which is managed by Sonatype). Itā€™s ā€œniceā€ to host things on the central repository because all Maven projects will check that location for libraries. With your way, we have to update our own project to use the additional repository :stuck_out_tongue:

I use Maven quite a bit with work and really like it, and it sounds like some people have misconceptions or just donā€™t know much about Maven so hereā€™s my take on what it can do and why itā€™s cuddly:

Maven is a combined dependency management system and project build/lifecycle manager. The build system is powerful but can be largely ignored if conventions are followed. The dependency manager is nice because it forces you to document the exact libraries AND their versions that you depend on. As said before, it will download the JARs for those dependencies, and the JARs of any transitive dependencies, etc. It will also resolve as best version conflicts between dependencies.

At work before Maven, my classpaths might grow to 50 jars in some of our servers, with libraries Iā€™d never use personally but were a dependency. If I wanted to update Struts or Hibernate, it was a very bug prone hassle to try and get the correct new versions of their dependencies. This is trivially easy to do with Maven and should not be sneezed at. I doubt my games will ever need that many dependencies, but itā€™s still nice to have as a feature.

There is a very nice Maven plugin for Eclipse so you still create your project through Eclipse (just a different type than plain Java). Eclipse still does all of the compiling and it can still do its magic classpath sharing between projects (even other Maven ones in your workspace). The plugin will automatically download the Javadocs and source associated with a dependency when you go to inspect an element, and links it for you into the normal Eclipse source inspection system.

By the time you need to build your final application, you might have to mess with some XML funny business, but thereā€™s a good chance youā€™d have done that with ant. Maven has much better fat-jar support compared with Eclipse.

IMO Maven helps keep your own projects more modularized because you can split them into separate modules. Do you have custom math functions and vectors, etc. Itā€™s a module. Physics library or helper code; itā€™s a module. Input system or event system, or core AI routines? Module. Then you can have them depend on each other as needed, and have a last module that brings them all together and implements your game.

Want to make a new game, just pull in your modules you want to reuse instead of trying to gut pieces by hand.