You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mark Eramo <ma...@trustvesta.com> on 2007/09/21 19:44:57 UTC

Excluding files from a jar

I have been trying to exclude certain files from the jar however it does 
not seem to be working. I am trying to do this with the include and 
exclude switches. I searched the mailing list and some posts say this 
should work, others say no so I am trying to find out if anyone has 
accomplished this with Maven 2.0.

For example, I have this in my pom.xml:

 <resources>
      <resource>
         <directory>${basedir}/target</directory>
         <excludes>
           <exclude>**/web/handlers/**/*.*</exclude>
         </excludes>
      </resource>
      <resource>
         <directory>${basedir}</directory>
         <includes>
           <include>ReleaseNotes.txt</include>
         </includes>
      </resource>
   </resources>

Now the include works, it adds the release notes to the jar but the 
exclude does not work. Very strange. Any ideas or comments on how to 
accomplish this would be much appreciated.
I know I could do it with the ant plugin after the compile phase (move 
the code I do not want out of the target folder) but I was hoping I 
could simply accomplish this with the excludes switch.

Regards,
Mark


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


Re: Excluding files from a jar

Posted by ro...@aciworldwide.com.
Here's a technique I received just the other day. I haven't done it yet, 
because the Maven port has been moved down my priority list by senior 
management, but it should work

> Here's how I patch Maven jars: 
> download the code from svn
> apply patch 
> modify pom to add -mycompany to version number ie 2.2.1.0-mycompany 
> (use your own company name here) 
> mvn install the file into your repo 
> "lock down" the plugin in your poms to the new version 
> <version>[2.2.1-mycompany]</version> 
>
> Its generally a bad idea to specify a version that might actually be 
> used in the future by the real maintainers of the plugin, that's why 
> -mycompany is a good idea. You definitely don't want to just bump the 
> version by 1. 


Mark Eramo <ma...@trustvesta.com> wrote on 09/21/2007 02:07:26 PM:

> Thanks for the links Robert. Based on the 2nd link, it looks like there 
> is some sort of patch for the plugin.
> Is this something that I can install locally and if so, can you 
> recommend the best way to do this?
> 

This email message and any attachments may contain confidential, 
proprietary or non-public information.  The information is intended solely 
for the designated recipient(s).  If an addressing or transmission error 
has misdirected this email, please notify the sender immediately and 
destroy this email.  Any review, dissemination, use or reliance upon this 
information by unintended recipients is prohibited.  Any opinions 
expressed in this email are those of the author personally.

Re: Excluding files from a jar

Posted by Mark Eramo <ma...@trustvesta.com>.
Thanks for the links Robert. Based on the 2nd link, it looks like there 
is some sort of patch for the plugin.
Is this something that I can install locally and if so, can you 
recommend the best way to do this?

Regards,
Mark

robert.egan@aciworldwide.com wrote:
> Known issue. check out these links.
>
> http://www.nabble.com/forum/Search.jtp?forum=178&local=y&query=MJAR-30 
> (previous discussion)
> http://jira.codehaus.org/browse/MJAR-30 (patch)
>
>
> Mark Eramo <ma...@trustvesta.com> wrote on 09/21/2007 01:44:57 PM:
>
>   
>> I have been trying to exclude certain files from the jar however it does 
>>     
>
>   
>> not seem to be working. I am trying to do this with the include and 
>> exclude switches. I searched the mailing list and some posts say this 
>> should work, others say no so I am trying to find out if anyone has 
>> accomplished this with Maven 2.0.
>>
>> For example, I have this in my pom.xml:
>>
>>  <resources>
>>       <resource>
>>          <directory>${basedir}/target</directory>
>>          <excludes>
>>            <exclude>**/web/handlers/**/*.*</exclude>
>>          </excludes>
>>       </resource>
>>       <resource>
>>          <directory>${basedir}</directory>
>>          <includes>
>>            <include>ReleaseNotes.txt</include>
>>          </includes>
>>       </resource>
>>    </resources>
>>
>> Now the include works, it adds the release notes to the jar but the 
>> exclude does not work. Very strange. Any ideas or comments on how to 
>> accomplish this would be much appreciated.
>> I know I could do it with the ant plugin after the compile phase (move 
>> the code I do not want out of the target folder) but I was hoping I 
>> could simply accomplish this with the excludes switch.
>>
>> Regards,
>> Mark
>>
>>     
>
> This email message and any attachments may contain confidential, 
> proprietary or non-public information.  The information is intended solely 
> for the designated recipient(s).  If an addressing or transmission error 
> has misdirected this email, please notify the sender immediately and 
> destroy this email.  Any review, dissemination, use or reliance upon this 
> information by unintended recipients is prohibited.  Any opinions 
> expressed in this email are those of the author personally.
>
>   

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


Re: Excluding files from a jar

Posted by ro...@aciworldwide.com.
Known issue. check out these links.

http://www.nabble.com/forum/Search.jtp?forum=178&local=y&query=MJAR-30 
(previous discussion)
http://jira.codehaus.org/browse/MJAR-30 (patch)


Mark Eramo <ma...@trustvesta.com> wrote on 09/21/2007 01:44:57 PM:

> I have been trying to exclude certain files from the jar however it does 

> not seem to be working. I am trying to do this with the include and 
> exclude switches. I searched the mailing list and some posts say this 
> should work, others say no so I am trying to find out if anyone has 
> accomplished this with Maven 2.0.
> 
> For example, I have this in my pom.xml:
> 
>  <resources>
>       <resource>
>          <directory>${basedir}/target</directory>
>          <excludes>
>            <exclude>**/web/handlers/**/*.*</exclude>
>          </excludes>
>       </resource>
>       <resource>
>          <directory>${basedir}</directory>
>          <includes>
>            <include>ReleaseNotes.txt</include>
>          </includes>
>       </resource>
>    </resources>
> 
> Now the include works, it adds the release notes to the jar but the 
> exclude does not work. Very strange. Any ideas or comments on how to 
> accomplish this would be much appreciated.
> I know I could do it with the ant plugin after the compile phase (move 
> the code I do not want out of the target folder) but I was hoping I 
> could simply accomplish this with the excludes switch.
> 
> Regards,
> Mark
> 

This email message and any attachments may contain confidential, 
proprietary or non-public information.  The information is intended solely 
for the designated recipient(s).  If an addressing or transmission error 
has misdirected this email, please notify the sender immediately and 
destroy this email.  Any review, dissemination, use or reliance upon this 
information by unintended recipients is prohibited.  Any opinions 
expressed in this email are those of the author personally.