Re: How to prevent renaming of third-party file?

2013-06-12 Thread Curtis Rueden
Hi Markus,

> How can I tell Maven that it must not rename the third party JAR when
> uploading it into Nexus

You cannot. One of the things that makes a Maven repository a Maven
repository is that it names things according to the Maven naming convention.

> to use the original third party file name when building the Class-Path
> (without providing a static Class-Path entry in my POM, which is
> definitively not what I want)?

This is definitely the direction I would pursue, to solve your issue.
However, looking at the documentation for maven-jar-plugin, I don't see an
easy way to customize *part* of your Class-Path entry. If you turn on
addClasspath, you get everything, according to the Maven naming convention.
There is one way to customize it: with classPathLayoutType=custom, and a
customClasspathLayout. But that would format *all* of your classpath
entries according to the same expression. It sounds like you want them all
formatted normally, except this one third-party entry. And unfortunately, I
doubt the customClasspathLayout expression language is powerful enough to
allow some uber-regex that will "do the right thing" in every case for you.

So my guess is that it's plugin writing time. (Unless, of course, you can
sidestep one of your other requirements, such as somehow renaming the
third-party JAR file on the target machine to match Maven's expectations.)

Another option, which might be simpler than customizing your build, would
be to use a custom ClassLoader at runtime to discover and load classes from
the uniquely-named third-party JAR file(s). Then you would have the full
power of Java to deal with various naming conventions, including if the
third-party JAR files change names or locations again in the future.

Regards,
Curtis


On Wed, Jun 12, 2013 at 1:38 AM, Markus Karg  wrote:

> My project is dependent on a third-party JAR file which will be
> installed on the target machine by a mechanism other than Maven. Hence,
> I have no influence on its actual file name.
>
>
>
> As I want Maven to automatically build the MANIFEST's Class-Path entry,
> I have put the same third-party JAR into my Nexus instance and added a
> dependency on it, which works well, but apparently renames the JAR file.
>
>
>
> So in the end my own JAR will not find that third party JAR on the
> target machine, as it simply seeks for the wrong name.
>
>
>
> How can I tell Maven that it must not rename the third party JAR when
> uploading it into Nexus and / or to use the original third party file
> name when building the Class-Path (without providing a static Class-Path
> entry in my POM, which is definitively not what I want)?
>
>
>
> Thanks!
>
> -Markus
>
>


How to prevent renaming of third-party file?

2013-06-11 Thread Markus Karg
My project is dependent on a third-party JAR file which will be
installed on the target machine by a mechanism other than Maven. Hence,
I have no influence on its actual file name.

 

As I want Maven to automatically build the MANIFEST's Class-Path entry,
I have put the same third-party JAR into my Nexus instance and added a
dependency on it, which works well, but apparently renames the JAR file.

 

So in the end my own JAR will not find that third party JAR on the
target machine, as it simply seeks for the wrong name.

 

How can I tell Maven that it must not rename the third party JAR when
uploading it into Nexus and / or to use the original third party file
name when building the Class-Path (without providing a static Class-Path
entry in my POM, which is definitively not what I want)?

 

Thanks!

-Markus