You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tich <ti...@gmail.com> on 2009/12/26 15:23:28 UTC

JNI binaries to maven module

Hello,

I need to use a JNI library in multiple modules of my maven project. The 
binaries of this library (dll and jars) are frequently updated so I 
don't want to manually add each file of the distribution to the maven 
repository.
So I decided to write a maven module that packages all the files of the 
JNI library in a zip file and now I would like to automatically add the 
jars of this archive to the dependencies of any other maven modules that 
need them at compile time.
As I am new to maven, I don't see what is the best way to do this.

Could someone help me ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: JNI binaries to maven module

Posted by Dan Tran <da...@gmail.com>.
you can use maven-dependency-plugin to unpack your zip for you, the
zip dont have to be in dependency list ( via unpack's goal)

On Sat, Dec 26, 2009 at 8:51 AM, Tich29 <ti...@gmail.com> wrote:
>
> This is certainly the simplest way to deploy the library but if I do it this
> way, I should have to write a pom file for each artifact to declare the
> dependencies between the artifacts of the library and, for convenience a
> parent pom that has a dependency on each artifact. So it can potentially
> generate a lot of work when updating the library.
>
> However, I think having an archive of all the files of the library is better
> because I have a single pom to maintain and the assembly that create the
> archive. And it allows me to keep a clean directory structure when unziping
> the archive. But I don't know how to tell maven to unpack the archive and
> automatically add a dependency on unpacked jar when compiling an other maven
> module which has a dependency on this library module.
>
> Is it possible ?
>
>
> Anders Hammar wrote:
>>
>> I'd suggest you do add each of the binaries of the library as separate
>> artifacts. Then you could use the normal dependency machanism of Maven.
>> Write a simple shell script that deploys all of the binaries to your repo
>> whenever they are update. That shell script could do pretty much anything
>> you want to; for example, unpack a distro zip and then deploy each of the
>> artifacts.
>>
>> As written here many times, don't fight the Maven way!
>> /Anders
>>
>> On Sat, Dec 26, 2009 at 15:23, Tich <ti...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I need to use a JNI library in multiple modules of my maven project. The
>>> binaries of this library (dll and jars) are frequently updated so I don't
>>> want to manually add each file of the distribution to the maven
>>> repository.
>>> So I decided to write a maven module that packages all the files of the
>>> JNI
>>> library in a zip file and now I would like to automatically add the jars
>>> of
>>> this archive to the dependencies of any other maven modules that need
>>> them
>>> at compile time.
>>> As I am new to maven, I don't see what is the best way to do this.
>>>
>>> Could someone help me ?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/JNI-binaries-to-maven-module-tp26927448p26928277.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: JNI binaries to maven module

Posted by Tich29 <ti...@gmail.com>.
This is certainly the simplest way to deploy the library but if I do it this
way, I should have to write a pom file for each artifact to declare the
dependencies between the artifacts of the library and, for convenience a
parent pom that has a dependency on each artifact. So it can potentially
generate a lot of work when updating the library.

However, I think having an archive of all the files of the library is better
because I have a single pom to maintain and the assembly that create the
archive. And it allows me to keep a clean directory structure when unziping
the archive. But I don't know how to tell maven to unpack the archive and
automatically add a dependency on unpacked jar when compiling an other maven
module which has a dependency on this library module.

Is it possible ? 


Anders Hammar wrote:
> 
> I'd suggest you do add each of the binaries of the library as separate
> artifacts. Then you could use the normal dependency machanism of Maven.
> Write a simple shell script that deploys all of the binaries to your repo
> whenever they are update. That shell script could do pretty much anything
> you want to; for example, unpack a distro zip and then deploy each of the
> artifacts.
> 
> As written here many times, don't fight the Maven way!
> /Anders
> 
> On Sat, Dec 26, 2009 at 15:23, Tich <ti...@gmail.com> wrote:
> 
>> Hello,
>>
>> I need to use a JNI library in multiple modules of my maven project. The
>> binaries of this library (dll and jars) are frequently updated so I don't
>> want to manually add each file of the distribution to the maven
>> repository.
>> So I decided to write a maven module that packages all the files of the
>> JNI
>> library in a zip file and now I would like to automatically add the jars
>> of
>> this archive to the dependencies of any other maven modules that need
>> them
>> at compile time.
>> As I am new to maven, I don't see what is the best way to do this.
>>
>> Could someone help me ?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/JNI-binaries-to-maven-module-tp26927448p26928277.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: JNI binaries to maven module

Posted by Donszelmann Mark <ma...@gmail.com>.
Hi

the idea is the following:

you publish your jni (dll and jar) file together as a nar artifact (that is a set of files) on some repository.

Then, in your other project you can just declare to be dependent on the nar file (in the very latest version  
of nar you need to depend on the nar type, previously depend on the jar type). 

The nar files get downloaded and unpacked. 

If you make the project of packaging type "nar" all unpacking will be done automatically and testing will
include the dll on the library-path. 

Regards
Mark

On Dec 27, 2009, at 8:53 PM, Francis Lalonde wrote:

> Can the nar-plugin also be used to provide the JNI libs dependencies at maven runtime for another plugin?
> 
> For example, I have a custom Borland starteam plugin that depends on the Starteam JNI DLL. I would like to be able to run that plugin in a standalone manner (mvn starteam:plugin) and have it download its required DLL (and unpack them if required) from the repo as it would  for jars. _That_ would be fantastic.
> 
> Francis
> 
> On 26/12/2009 6:00 PM, Donszelmann Mark wrote:
>> Hi
>> 
>> there is an example in the source of a 3rd party jni library, which is what you want.
>> 
>> Regards
>> Mark
>> 
>> On Dec 26, 2009, at 6:23 PM, Tich29 wrote:
>> 
>>   
>>> Hi,
>>> I just took a look on the maven-nar-plugin and it seems to be used to
>>> compile and package a JNI library but I don't have to compile my library.
>>> Perharps this plugin can be used so as it skips the compilation of the
>>> library ?
>>> 
>>> 
>>> duns wrote:
>>>     
>>>> Hi
>>>> 
>>>> or use the maven-nar-plugin at http://duns.github.com/maven-nar-plugin/
>>>> 
>>>> which handles most of this for you.
>>>> 
>>>> Regards
>>>> Mark Donszelmann
>>>> 
>>>> On Dec 26, 2009, at 3:43 PM, Anders Hammar wrote:
>>>> 
>>>>       
>>>>> I'd suggest you do add each of the binaries of the library as separate
>>>>> artifacts. Then you could use the normal dependency machanism of Maven.
>>>>> Write a simple shell script that deploys all of the binaries to your repo
>>>>> whenever they are update. That shell script could do pretty much anything
>>>>> you want to; for example, unpack a distro zip and then deploy each of the
>>>>> artifacts.
>>>>> 
>>>>> As written here many times, don't fight the Maven way!
>>>>> /Anders
>>>>> 
>>>>> On Sat, Dec 26, 2009 at 15:23, Tich<ti...@gmail.com>  wrote:
>>>>> 
>>>>>         
>>>>>> Hello,
>>>>>> 
>>>>>> I need to use a JNI library in multiple modules of my maven project. The
>>>>>> binaries of this library (dll and jars) are frequently updated so I
>>>>>> don't
>>>>>> want to manually add each file of the distribution to the maven
>>>>>> repository.
>>>>>> So I decided to write a maven module that packages all the files of the
>>>>>> JNI
>>>>>> library in a zip file and now I would like to automatically add the jars
>>>>>> of
>>>>>> this archive to the dependencies of any other maven modules that need
>>>>>> them
>>>>>> at compile time.
>>>>>> As I am new to maven, I don't see what is the best way to do this.
>>>>>> 
>>>>>> Could someone help me ?
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>> 
>>>>>> 
>>>>>>           
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>> 
>>>> 
>>>> 
>>>>       
>>> -- 
>>> View this message in context: http://old.nabble.com/JNI-binaries-to-maven-module-tp26927448p26928451.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
>>>     
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: JNI binaries to maven module

Posted by Francis Lalonde <fr...@ca.inter.net>.
Can the nar-plugin also be used to provide the JNI libs dependencies at 
maven runtime for another plugin?

For example, I have a custom Borland starteam plugin that depends on the 
Starteam JNI DLL. I would like to be able to run that plugin in a 
standalone manner (mvn starteam:plugin) and have it download its 
required DLL (and unpack them if required) from the repo as it would  
for jars. _That_ would be fantastic.

Francis

On 26/12/2009 6:00 PM, Donszelmann Mark wrote:
> Hi
>
> there is an example in the source of a 3rd party jni library, which is what you want.
>
> Regards
> Mark
>
> On Dec 26, 2009, at 6:23 PM, Tich29 wrote:
>
>    
>> Hi,
>> I just took a look on the maven-nar-plugin and it seems to be used to
>> compile and package a JNI library but I don't have to compile my library.
>> Perharps this plugin can be used so as it skips the compilation of the
>> library ?
>>
>>
>> duns wrote:
>>      
>>> Hi
>>>
>>> or use the maven-nar-plugin at http://duns.github.com/maven-nar-plugin/
>>>
>>> which handles most of this for you.
>>>
>>> Regards
>>> Mark Donszelmann
>>>
>>> On Dec 26, 2009, at 3:43 PM, Anders Hammar wrote:
>>>
>>>        
>>>> I'd suggest you do add each of the binaries of the library as separate
>>>> artifacts. Then you could use the normal dependency machanism of Maven.
>>>> Write a simple shell script that deploys all of the binaries to your repo
>>>> whenever they are update. That shell script could do pretty much anything
>>>> you want to; for example, unpack a distro zip and then deploy each of the
>>>> artifacts.
>>>>
>>>> As written here many times, don't fight the Maven way!
>>>> /Anders
>>>>
>>>> On Sat, Dec 26, 2009 at 15:23, Tich<ti...@gmail.com>  wrote:
>>>>
>>>>          
>>>>> Hello,
>>>>>
>>>>> I need to use a JNI library in multiple modules of my maven project. The
>>>>> binaries of this library (dll and jars) are frequently updated so I
>>>>> don't
>>>>> want to manually add each file of the distribution to the maven
>>>>> repository.
>>>>> So I decided to write a maven module that packages all the files of the
>>>>> JNI
>>>>> library in a zip file and now I would like to automatically add the jars
>>>>> of
>>>>> this archive to the dependencies of any other maven modules that need
>>>>> them
>>>>> at compile time.
>>>>> As I am new to maven, I don't see what is the best way to do this.
>>>>>
>>>>> Could someone help me ?
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>>
>>>>>            
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>        
>> -- 
>> View this message in context: http://old.nabble.com/JNI-binaries-to-maven-module-tp26927448p26928451.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>      
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: JNI binaries to maven module

Posted by Donszelmann Mark <ma...@gmail.com>.
Hi

there is an example in the source of a 3rd party jni library, which is what you want. 

Regards
Mark

On Dec 26, 2009, at 6:23 PM, Tich29 wrote:

> 
> Hi,
> I just took a look on the maven-nar-plugin and it seems to be used to
> compile and package a JNI library but I don't have to compile my library.
> Perharps this plugin can be used so as it skips the compilation of the
> library ? 
> 
> 
> duns wrote:
>> 
>> Hi
>> 
>> or use the maven-nar-plugin at http://duns.github.com/maven-nar-plugin/
>> 
>> which handles most of this for you. 
>> 
>> Regards
>> Mark Donszelmann
>> 
>> On Dec 26, 2009, at 3:43 PM, Anders Hammar wrote:
>> 
>>> I'd suggest you do add each of the binaries of the library as separate
>>> artifacts. Then you could use the normal dependency machanism of Maven.
>>> Write a simple shell script that deploys all of the binaries to your repo
>>> whenever they are update. That shell script could do pretty much anything
>>> you want to; for example, unpack a distro zip and then deploy each of the
>>> artifacts.
>>> 
>>> As written here many times, don't fight the Maven way!
>>> /Anders
>>> 
>>> On Sat, Dec 26, 2009 at 15:23, Tich <ti...@gmail.com> wrote:
>>> 
>>>> Hello,
>>>> 
>>>> I need to use a JNI library in multiple modules of my maven project. The
>>>> binaries of this library (dll and jars) are frequently updated so I
>>>> don't
>>>> want to manually add each file of the distribution to the maven
>>>> repository.
>>>> So I decided to write a maven module that packages all the files of the
>>>> JNI
>>>> library in a zip file and now I would like to automatically add the jars
>>>> of
>>>> this archive to the dependencies of any other maven modules that need
>>>> them
>>>> at compile time.
>>>> As I am new to maven, I don't see what is the best way to do this.
>>>> 
>>>> Could someone help me ?
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
>> 
> 
> -- 
> View this message in context: http://old.nabble.com/JNI-binaries-to-maven-module-tp26927448p26928451.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: JNI binaries to maven module

Posted by Tich29 <ti...@gmail.com>.
Hi,
I just took a look on the maven-nar-plugin and it seems to be used to
compile and package a JNI library but I don't have to compile my library.
Perharps this plugin can be used so as it skips the compilation of the
library ? 


duns wrote:
> 
> Hi
> 
> or use the maven-nar-plugin at http://duns.github.com/maven-nar-plugin/
> 
> which handles most of this for you. 
> 
> Regards
> Mark Donszelmann
> 
> On Dec 26, 2009, at 3:43 PM, Anders Hammar wrote:
> 
>> I'd suggest you do add each of the binaries of the library as separate
>> artifacts. Then you could use the normal dependency machanism of Maven.
>> Write a simple shell script that deploys all of the binaries to your repo
>> whenever they are update. That shell script could do pretty much anything
>> you want to; for example, unpack a distro zip and then deploy each of the
>> artifacts.
>> 
>> As written here many times, don't fight the Maven way!
>> /Anders
>> 
>> On Sat, Dec 26, 2009 at 15:23, Tich <ti...@gmail.com> wrote:
>> 
>>> Hello,
>>> 
>>> I need to use a JNI library in multiple modules of my maven project. The
>>> binaries of this library (dll and jars) are frequently updated so I
>>> don't
>>> want to manually add each file of the distribution to the maven
>>> repository.
>>> So I decided to write a maven module that packages all the files of the
>>> JNI
>>> library in a zip file and now I would like to automatically add the jars
>>> of
>>> this archive to the dependencies of any other maven modules that need
>>> them
>>> at compile time.
>>> As I am new to maven, I don't see what is the best way to do this.
>>> 
>>> Could someone help me ?
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
>>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/JNI-binaries-to-maven-module-tp26927448p26928451.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: JNI binaries to maven module

Posted by Donszelmann Mark <ma...@gmail.com>.
Hi

or use the maven-nar-plugin at http://duns.github.com/maven-nar-plugin/

which handles most of this for you. 

Regards
Mark Donszelmann

On Dec 26, 2009, at 3:43 PM, Anders Hammar wrote:

> I'd suggest you do add each of the binaries of the library as separate
> artifacts. Then you could use the normal dependency machanism of Maven.
> Write a simple shell script that deploys all of the binaries to your repo
> whenever they are update. That shell script could do pretty much anything
> you want to; for example, unpack a distro zip and then deploy each of the
> artifacts.
> 
> As written here many times, don't fight the Maven way!
> /Anders
> 
> On Sat, Dec 26, 2009 at 15:23, Tich <ti...@gmail.com> wrote:
> 
>> Hello,
>> 
>> I need to use a JNI library in multiple modules of my maven project. The
>> binaries of this library (dll and jars) are frequently updated so I don't
>> want to manually add each file of the distribution to the maven repository.
>> So I decided to write a maven module that packages all the files of the JNI
>> library in a zip file and now I would like to automatically add the jars of
>> this archive to the dependencies of any other maven modules that need them
>> at compile time.
>> As I am new to maven, I don't see what is the best way to do this.
>> 
>> Could someone help me ?
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: JNI binaries to maven module

Posted by Anders Hammar <an...@hammar.net>.
I'd suggest you do add each of the binaries of the library as separate
artifacts. Then you could use the normal dependency machanism of Maven.
Write a simple shell script that deploys all of the binaries to your repo
whenever they are update. That shell script could do pretty much anything
you want to; for example, unpack a distro zip and then deploy each of the
artifacts.

As written here many times, don't fight the Maven way!
/Anders

On Sat, Dec 26, 2009 at 15:23, Tich <ti...@gmail.com> wrote:

> Hello,
>
> I need to use a JNI library in multiple modules of my maven project. The
> binaries of this library (dll and jars) are frequently updated so I don't
> want to manually add each file of the distribution to the maven repository.
> So I decided to write a maven module that packages all the files of the JNI
> library in a zip file and now I would like to automatically add the jars of
> this archive to the dependencies of any other maven modules that need them
> at compile time.
> As I am new to maven, I don't see what is the best way to do this.
>
> Could someone help me ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>