You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Yang <te...@gmail.com> on 2011/08/15 21:49:18 UTC

how to add *.java source files in my jar?

when I build a jar to be exported, I'd like to also include the java
sources files so that users can
immediately see the source files when he does "show type definition"
in eclipse, and not having to do "attach source files".


I looked around the the config options of maven-jar-plugin, doesn't
seem there is anything for that;
the maven-source-plugin could do it, but it generates a different file name.


what is the best approach to do this?

Thanks
Yang

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


Re: how to add *.java source files in my jar?

Posted by Yang <te...@gmail.com>.
Thanks Jesse, this is perfect

On Mon, Aug 15, 2011 at 4:12 PM, Jesse Farinacci <ji...@gmail.com> wrote:
> Greetings,
>
> On Mon, Aug 15, 2011 at 6:46 PM, Wayne Fay <wa...@gmail.com> wrote:
>> I remember seeing this on the Maven Users list a couple times. I think
>> they were from a project that someone was using GWT with since GWT
>> likes to bundle certain source files into its jars.
>
> http://mojo.codehaus.org/gwt-maven-plugin/user-guide/project.html#Multi-project_setup
>
> -Jesse
>
> --
> There are 10 types of people in this world, those
> that can read binary and those that can not.
>
> ---------------------------------------------------------------------
> 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: how to add *.java source files in my jar?

Posted by Jesse Farinacci <ji...@gmail.com>.
Greetings,

On Mon, Aug 15, 2011 at 6:46 PM, Wayne Fay <wa...@gmail.com> wrote:
> I remember seeing this on the Maven Users list a couple times. I think
> they were from a project that someone was using GWT with since GWT
> likes to bundle certain source files into its jars.

http://mojo.codehaus.org/gwt-maven-plugin/user-guide/project.html#Multi-project_setup

-Jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

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


Re: how to add *.java source files in my jar?

Posted by Wayne Fay <wa...@gmail.com>.
> Somewhere in the back of my head I recall an issue that a lot of
> people ran into due to the fact that some open source project included
> some .java files in their jar. I might recall wrong, but I would keep

I remember seeing this on the Maven Users list a couple times. I think
they were from a project that someone was using GWT with since GWT
likes to bundle certain source files into its jars. Then when you try
to compile things, javac finds those source files and compiles them
into /target if the classpath has everything you would need to
actually compile those files, otherwise it just complains loudly.

Your best approach is to simply use the proper (sources) plugin and
create another artifact with sources.

Wayne

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


Re: how to add *.java source files in my jar?

Posted by Luke Patterson <lu...@gmail.com>.
Hamcrest had something like that

-- sent from a mobile device with a small keyboard, so message may be brief
--
On Aug 15, 2011 2:57 PM, "Anders Hammar" <an...@hammar.net> wrote:
>
> Somewhere in the back of my head I recall an issue that a lot of
> people ran into due to the fact that some open source project included
> some .java files in their jar. I might recall wrong, but I would keep
> the java source files in a separate jar file (as is the de facto
> standard in maven repos).
>
> /Anders
>
> On Mon, Aug 15, 2011 at 21:53, Olivier Lamy <ol...@apache.org> wrote:
> > Hello,
> > See source plugin :
> > http://maven.apache.org/plugins/maven-source-plugin/usage.html
> >
> >
> > 2011/8/15 Yang <te...@gmail.com>:
> >> when I build a jar to be exported, I'd like to also include the java
> >> sources files so that users can
> >> immediately see the source files when he does "show type definition"
> >> in eclipse, and not having to do "attach source files".
> >>
> >>
> >> I looked around the the config options of maven-jar-plugin, doesn't
> >> seem there is anything for that;
> >> the maven-source-plugin could do it, but it generates a different file
name.
> >>
> >>
> >> what is the best approach to do this?
> >>
> >> Thanks
> >> Yang
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
> >
> > --
> > Olivier Lamy
> > Talend : http://talend.com
> > http://twitter.com/olamy | http://linkedin.com/in/olamy
> >
> > ---------------------------------------------------------------------
> > 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: how to add *.java source files in my jar?

Posted by Anders Hammar <an...@hammar.net>.
Somewhere in the back of my head I recall an issue that a lot of
people ran into due to the fact that some open source project included
some .java files in their jar. I might recall wrong, but I would keep
the java source files in a separate jar file (as is the de facto
standard in maven repos).

/Anders

On Mon, Aug 15, 2011 at 21:53, Olivier Lamy <ol...@apache.org> wrote:
> Hello,
> See source plugin :
> http://maven.apache.org/plugins/maven-source-plugin/usage.html
>
>
> 2011/8/15 Yang <te...@gmail.com>:
>> when I build a jar to be exported, I'd like to also include the java
>> sources files so that users can
>> immediately see the source files when he does "show type definition"
>> in eclipse, and not having to do "attach source files".
>>
>>
>> I looked around the the config options of maven-jar-plugin, doesn't
>> seem there is anything for that;
>> the maven-source-plugin could do it, but it generates a different file name.
>>
>>
>> what is the best approach to do this?
>>
>> Thanks
>> Yang
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
>
> --
> Olivier Lamy
> Talend : http://talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> ---------------------------------------------------------------------
> 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: how to add *.java source files in my jar?

Posted by Yang <te...@gmail.com>.
yeah, I did notice this, and can indeed produce one jar with both
class files and java files,
but this output is named myproject-version-sources.jar

I guess I could find some way to change the name, but that's not
clean, and I'm not sure whether the output of jar:jar would overwrite
that....

On Mon, Aug 15, 2011 at 12:53 PM, Olivier Lamy <ol...@apache.org> wrote:
> Hello,
> See source plugin :
> http://maven.apache.org/plugins/maven-source-plugin/usage.html
>
>
> 2011/8/15 Yang <te...@gmail.com>:
>> when I build a jar to be exported, I'd like to also include the java
>> sources files so that users can
>> immediately see the source files when he does "show type definition"
>> in eclipse, and not having to do "attach source files".
>>
>>
>> I looked around the the config options of maven-jar-plugin, doesn't
>> seem there is anything for that;
>> the maven-source-plugin could do it, but it generates a different file name.
>>
>>
>> what is the best approach to do this?
>>
>> Thanks
>> Yang
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
>
> --
> Olivier Lamy
> Talend : http://talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> ---------------------------------------------------------------------
> 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: how to add *.java source files in my jar?

Posted by Olivier Lamy <ol...@apache.org>.
Hello,
See source plugin :
http://maven.apache.org/plugins/maven-source-plugin/usage.html


2011/8/15 Yang <te...@gmail.com>:
> when I build a jar to be exported, I'd like to also include the java
> sources files so that users can
> immediately see the source files when he does "show type definition"
> in eclipse, and not having to do "attach source files".
>
>
> I looked around the the config options of maven-jar-plugin, doesn't
> seem there is anything for that;
> the maven-source-plugin could do it, but it generates a different file name.
>
>
> what is the best approach to do this?
>
> Thanks
> Yang
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



-- 
Olivier Lamy
Talend : http://talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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