You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dipankar Ghosal <di...@globallogic.com> on 2008/05/01 09:35:45 UTC
Re: How to specify local dependency in maven2
Hi,
Thanks for the replies.
Well this is what i did to get things going
<dependency>
<groupId>portlet</groupId>
<artifactId>wp.struts.standard.framework</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/wp.struts.standard.framework.jar</systemPath>
</dependency>
I hope this is one way to tell maven to pick the jar from system path while
building.
Shakun Gupta wrote:
>
> Hi Dipankar,
>
> You can not add jars from any local directory to maven. But, if the jars
> exist at some path like <some-path>/abc/jars
> Then you have to add a private repository in pom.xml as
> <repositories>
> <repository>
> <layout>legacy</layout>
> <id>AbcRepository</id>
> <name>AbcRepository</name>
> <url>file:///<some-path></url>
> </repository>
> </repositories>
>
> and give the dependencies as
> <dependency>
> <groupId>abc</groupId>
> <artifactId>junit</artifactId>
> <version>4.4</version>
> <scope>test</scope>
> </dependency>
>
> Basically, if you give layout as "legacy" then it will search for the
> pom at the location repositry-url/$groupId/pom/$artifactId-$version.pom
> and will search for the jar at the location
> repositry-url/$groupId/jars/$artifactId-$version.jar
>
> So, in your case you can use the following two approcahes :
> 1. you move your jars from library C:\lib to some directory say
> C:\abc\jars and use the above snippets
> 2. write a script which will create the folder structure
> $groupId/$atrifactId/$version and copy the jars in this directory, then
> you can use the approach the Samuel has suggested.
> I will suggest to use the second approach.
>
> But, the best approach is to use the maven repositories and with the
> m2eclipse plugin, you just have to type the name of the jar, it will
> automatically give you a list of all the matching jars, then you select
> which version to use and it will automatically modify the pom.xml
>
> Regards,
> Shakun
>
> Samuel Le Berrigaud wrote:
>> Not that I know of. And I believe there is not.
>>
>> The maven way of managing dependencies is to declare those in the POM (or
>> to
>> get them transitively for maven2), using libraries from a directory would
>> go
>> against that.
>>
>> Hope it helps.
>> SaM
>>
>> On Tue, Mar 4, 2008 at 6:36 PM, Dipankar Ghosal <
>> dipankar.ghosal@globallogic.com> wrote:
>>
>>
>>> Thanks Samuel..
>>>
>>> However is there any way to include all libraries that are present in a
>>> particular folder.
>>> Say i have 20 odd jars in C:\lib folder?
>>>
>>>
>>>
>>> Samuel Le Berrigaud wrote:
>>>
>>>> Hi,
>>>>
>>>> you would have to use the system scope. See the system dependencies
>>>> section
>>>> at
>>>>
>>>>
>>> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>>>
>>>> .
>>>>
>>>> However I would recommend you create a private repository internally to
>>>> your
>>>> company so that you can more easily share those dependencies with your
>>>> team.
>>>> This way those dependencies will work the same way as any other maven
>>>> dependency. Consistency is good.
>>>>
>>>> SaM
>>>>
>>>> On Tue, Mar 4, 2008 at 6:00 PM, Dipankar Ghosal <
>>>> dipankar.ghosal@globallogic.com> wrote:
>>>>
>>>>
>>>>> I have a WebSphere Portlet project which uses many IBM jars(Available
>>>>>
>>> at
>>>
>>>>> installation directory in local system).
>>>>>
>>>>> I need to use these jars while performing maven build.
>>>>>
>>>>> How do i specify the location of the jars so that maven uses the jars
>>>>> from
>>>>> local location rather than download from remote repository.
>>>>>
>>>>> Is there any option like specifying the local jars in
>>>>> project.properties(available in maven 1.1)
>>>>> ################################################
>>>>> #
>>>>> # Register local jar files to maven. This prevents maven from
>>>>> # trying to download these dependencies
>>>>> #
>>>>> ################################################
>>>>> maven.jar.wps = ${wps.home}/wps.jar
>>>>> maven.jar.jsr168-api = ${wps.home}/shared/app/jsr168-api.jar
>>>>>
>>>>> Any help will be appreciated
>>>>> --
>>>>> View this message in context:
>>>>>
>>>>>
>>> http://www.nabble.com/How-to-specify-local-dependency-in-maven2-tp15821419s177p15821419.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
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Samuel Le Berrigaud
>>>>
>>>>
>>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-specify-local-dependency-in-maven2-tp15821419s177p15821761.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
>>>
>>>
>>>
>>
>>
>>
>
>
>
--
View this message in context: http://www.nabble.com/How-to-specify-local-dependency-in-maven2-tp15821419s177p16993045.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