Hi Everyone,

To follow up what I have done to solve my problem, this is how I approached it.

First I tried maven-source-plugin using the configuration <includes> This was 
able to bring in artifacts into the projects sources.jar but it had some 
unwanted side effects with a custom mojo I was using where it ONLY gathered 
artifacts defined from maven-source-plugin and not from a custom properties 
file.

The solution I used was to first bring include the artifacts I wanted to add 
into both the projects jar and the sources.jar. Then I had used 
maven-jar-plugin with a configuration for <excludes> to remove the artifacts 
from the projects jar. This had the artifacts I wanted to be included in the 
projects sources.jar and not bundled as part of the projects jar.

Thanks everyone for the suggestions.

Phillip

-----Original Message-----
From: Adrien Rivard [mailto:adrien.riv...@gmail.com] 
Sent: Saturday, April 11, 2015 1:50 PM
To: Maven Users List
Subject: Re: Add file to sources jar

Hi,

If I understand it right, the jar produce by the maven-source-plugin  can be 
customized via 
https://maven.apache.org/plugins/maven-source-plugin/jar-no-fork-mojo.html#archive

Predefined assembly descriptors files may be worth looking at, src and project 
in particular.
http://maven.apache.org/components/plugins/maven-assembly-plugin/descriptor-refs.html#src

Also http://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html#excludes
could be interesting.


On Fri, Apr 10, 2015 at 4:33 AM, Dan Tran <dant...@gmail.com> wrote:

> truezip-maven-plugin can insert files into existing jar on the fly
>
> -d
>
> On Thu, Apr 9, 2015 at 4:42 PM, Gribnau, Phillip 
> <pgrib...@informatica.com
> >
> wrote:
>
> > Hi Everyone,
> >
> > Say I have a maven project that produces 2 jars called project.jar 
> > and project-sources.jar. I have a requirement where a file needs to 
> > be
> included
> > in project-sources.jar and NOT included in project.jar. Is there a 
> > way to accomplish this with current maven functionality or plugins?
> >
> > I have a custom maven plugin available to me that reads a
> build.properties
> > to add files into the jar using 
> > MavenProject.addCompileSourceRoot(String
> > path), however this adds the file to both project.jar and 
> > project-sources.jar. After looking through some maven API's and 
> > source
> code
> > I could not find a way to accomplish this. If there are some methods 
> > available as part of the public maven API that would also work.
> >
> > Is there an existing plugin or public API that can help accomplish 
> > adding a file into project-sources.jar but NOT project.jar?
> >
> > I am using Maven 3.2.5.
> >
> > Thanks,
> > Phillip
> >
>



--
Adrien Rivard

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

Reply via email to