Store the Nexus / Maven artifact without a version number

advertisements

I need to store an artifact in Maven/Nexus but when it's pulled down it must not have a version number at the end.

Before you berate me, point your scowl at Oracle.

I have comm.jar (Oracle comm port driver). I've put this in my nexus server & it comes down as comm-1.0.jar. But the JAR contains the following code:

if(streamtokenizer.ttype == -3
    && (i = streamtokenizer.sval.indexOf("comm.jar")) != -1)

It's hard coded to use its own name to know where to find the configuration file that goes with it. The jar is signed so I can't make changes to it.

So... how to I store a jar in Nexus and not have an extension number on it ?


This isn't the exact answer to my question but it does solve my problem.

I called my jar "comm.jar-1.0.2.jar" The code looks for 'comm.jar' in the file name so now it finds it! ok, so it a fudge and I'm lucky the internal code is just looking for indexOf. but it works!

Thanks to everyone for there advice on this!

Jeff


This isn't a complete answer, more a collection of thoughts on how you might approach this.

I think you will need to declare your dependency with the version number present, to ensure Maven is happy to resolve the artifact and build it. So, the trick will be ensuring the aritfact is renamed before it is bundled in your finished product.

The Maven dependency:copy-dependencies goal has a stripVersion parameter that might come in useful. I suspect you can use this to rename the JAR correctly, perhaps as part of an assembly (ensuring the depedency is moved to a directory that is part of the classpath).

Such a plan may well break your development environment, however. Perhaps you can get around that by fudging a JAR file with the right name?