You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sean McNamara <ta...@yahoo.com> on 2006/04/27 21:41:32 UTC
Adding source to jar?
I'm sure this is documented somewhere, but I could really use a quick answer: What needs to be done in order to package a directory of source code inside a jar?
Example:
target/generated-sources/com/foo/bar/MyClass.java
target/classes/com/foo/bar/MyClass.class
I want to have both classes in my jarfile:
com/foo/bar/MyClass.java
com/foo/bar/MyClass.class
Any pointers appreciated.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Adding source to jar?
Posted by Sean McNamara <ta...@yahoo.com>.
Thanks Wendy! I feel like you're becoming my personal answer machine these days....
Thanks again!
----- Original Message ----
From: Wendy Smoak <ws...@gmail.com>
To: Maven Users List <us...@maven.apache.org>
Sent: Thursday, April 27, 2006 2:57:28 PM
Subject: Re: Adding source to jar?
On 4/27/06, Sean McNamara <ta...@yahoo.com> wrote:
> I'm sure this is documented somewhere, but I could really use a quick answer: What needs to be done in order to package a directory of source code inside a jar?
Treat it like any other resource you want to include:
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
...
</resources>
If you wanted it to appear in a 'src' directory rather than mixed in
with the .class files, you could add <targetPath>src/</targetPath> to
the <resource>.
If you also have files in the usual place, src/main/resources, I think
you'll have to explicitly add them since you're overriding the
<resources> element:
<resource>
<directory>src/main/resources</directory>
</resource>
HTH,
--
Wendy
---------------------------------------------------------------------
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: Adding source to jar?
Posted by Wendy Smoak <ws...@gmail.com>.
On 4/27/06, Sean McNamara <ta...@yahoo.com> wrote:
> I'm sure this is documented somewhere, but I could really use a quick answer: What needs to be done in order to package a directory of source code inside a jar?
Treat it like any other resource you want to include:
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
...
</resources>
If you wanted it to appear in a 'src' directory rather than mixed in
with the .class files, you could add <targetPath>src/</targetPath> to
the <resource>.
If you also have files in the usual place, src/main/resources, I think
you'll have to explicitly add them since you're overriding the
<resources> element:
<resource>
<directory>src/main/resources</directory>
</resource>
HTH,
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org