You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Pawel Stawicki <pa...@gmail.com> on 2008/04/14 14:39:22 UTC

How to add jars to classpath?

Hi,

I want to compile project which has some dependencies, but not
maven-like ones. I just have some jar files on my disc and I want to add
them to classpath. I tried something like

compile.with file(<jar_path>)

But it doesn't work. I get errors because of not satisfied dependencies.

How to do this?

Best regards
Pawel Stawicki

Re: How to add jars to classpath?

Posted by Alexis Midon <al...@gmail.com>.
On Mon, Apr 14, 2008 at 6:54 AM, Pawel Stawicki <pa...@gmail.com>
wrote:

> Alexis Midon wrote:
> > you just have to use the artifact#from method:
> >
> > bean = artifact("example.com:beans:jar:1.0").from("/path/to/your/jar")
>
> Then I get error:
> Don't know how to build task
> '/home/amorfis/workspace/ncdc-libs/commons-lang/commons-lang-2.3.jar'
>

if the file does not exist at that path you may have to tell Buildr how to
build it. You may want to check this section of the doc:
http://incubator.apache.org/buildr/artifacts.html



>
> Besides, I don't think "example.com:beans:jar:1.0" is valid spec for all
> my jars.
>

is that what you're looking for?


>
> Best regards
> Pawel Stawicki
>

Re: How to add jars to classpath?

Posted by Pawel Stawicki <pa...@gmail.com>.
Alexis Midon wrote:
> you just have to use the artifact#from method:
> 
> bean = artifact("example.com:beans:jar:1.0").from("/path/to/your/jar")

Then I get error:
Don't know how to build task
'/home/amorfis/workspace/ncdc-libs/commons-lang/commons-lang-2.3.jar'

Besides, I don't think "example.com:beans:jar:1.0" is valid spec for all
my jars.

Best regards
Pawel Stawicki

Re: How to add jars to classpath?

Posted by Alexis Midon <al...@gmail.com>.
you just have to use the artifact#from method:

bean = artifact("example.com:beans:jar:1.0").from("/path/to/your/jar")



On Mon, Apr 14, 2008 at 5:39 AM, Pawel Stawicki <pa...@gmail.com>
wrote:

> Hi,
>
> I want to compile project which has some dependencies, but not
> maven-like ones. I just have some jar files on my disc and I want to add
> them to classpath. I tried something like
>
> compile.with file(<jar_path>)
>
> But it doesn't work. I get errors because of not satisfied dependencies.
>
> How to do this?
>
> Best regards
> Pawel Stawicki
>

Re: How to add jars to classpath?

Posted by Pawel Stawicki <pa...@gmail.com>.
I found it out, it was mistake in my path. Sorry for the mess, now
everything works fine.

Best regards
Pawel Stawicki

Re: How to add jars to classpath?

Posted by Paweł Stawicki <pa...@gmail.com>.
>  > Hi,
>  >
>  > I want to compile project which has some dependencies, but not
>  > maven-like ones. I just have some jar files on my disc and I want to add
>  > them to classpath. I tried something like
>  >
>  > compile.with file(<jar_path>)
>  >
>  > But it doesn't work. I get errors because of not satisfied dependencies.
>
>
>  compile.with <jar_path> will also work.  You can use either a filename or a
>  file task.
>
>  The only thing added to the classpath is that JAR, so maybe it's missing
>  some classes, or you need to add another dependency?

No, the file for sure exists. I added it to classpath, but I was
debugging buildr, and compile task invoked later was different task,
with empty classpath.

I am trying to migrate from our company's build system to buildr. We
have a lot of jars in our own repository and ant task, which can get
jars from repository based on eclipse classpath. So files and their
paths are not hardcoded, I get it in runtime in buildr, and this I
already did. What I can't do is to add them to classpath and compile
project.

Best regards
Pawel Stawicki

Re: How to add jars to classpath?

Posted by Assaf Arkin <ar...@intalio.com>.
On Mon, Apr 14, 2008 at 5:39 AM, Pawel Stawicki <pa...@gmail.com>
wrote:

> Hi,
>
> I want to compile project which has some dependencies, but not
> maven-like ones. I just have some jar files on my disc and I want to add
> them to classpath. I tried something like
>
> compile.with file(<jar_path>)
>
> But it doesn't work. I get errors because of not satisfied dependencies.


compile.with <jar_path> will also work.  You can use either a filename or a
file task.

The only thing added to the classpath is that JAR, so maybe it's missing
some classes, or you need to add another dependency?

Assaf


>
>
> How to do this?
>
> Best regards
> Pawel Stawicki
>



-- 
CTO, Intalio
http://www.intalio.com