You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Li Li <fa...@gmail.com> on 2014/04/03 11:24:40 UTC

how to exclude log4j.properties when mvn assembly:single?

I want to jar my program with all the dependencies. I have a
dependency of hadoop. the log4j.properties is included in my
application.
how to exclude it?
I have tried this but no luck

<artifactId>maven-assembly-plugin</artifactId>
   <configuration>
     <excludes>
     <exclude>**/log4j.properties</exclude>
     </excludes>

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


Re: how to exclude log4j.properties when mvn assembly:single?

Posted by Mirko Friedenhagen <mf...@gmail.com>.
Hello Li Li,

you might take a look at the maven-shade-plugin as well, which is easier to
use IMO.

Regards
Mirko
-- 
Sent from my mobile
On Apr 4, 2014 3:20 AM, "Li Li" <fa...@gmail.com> wrote:

> I want to make it runnable simply by java -jar xxx.jar
> build jars will copy all other dependencys
>
> On Thu, Apr 3, 2014 at 8:52 PM, Ron Wheeler
> <rw...@artifact-software.com> wrote:
> > Why are you using the assembly-plugin?
> > You normally don't need it to build jars.
> >
> >
> >
> >
> > On 03/04/2014 5:24 AM, Li Li wrote:
> >>
> >> I want to jar my program with all the dependencies. I have a
> >> dependency of hadoop. the log4j.properties is included in my
> >> application.
> >> how to exclude it?
> >> I have tried this but no luck
> >>
> >> <artifactId>maven-assembly-plugin</artifactId>
> >>     <configuration>
> >>       <excludes>
> >>       <exclude>**/log4j.properties</exclude>
> >>       </excludes>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
> > --
> > Ron Wheeler
> > President
> > Artifact Software Inc
> > email: rwheeler@artifact-software.com
> > skype: ronaldmwheeler
> > phone: 866-970-2435, ext 102
> >
> >
> > ---------------------------------------------------------------------
> > 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 exclude log4j.properties when mvn assembly:single?

Posted by Li Li <fa...@gmail.com>.
I want to make it runnable simply by java -jar xxx.jar
build jars will copy all other dependencys

On Thu, Apr 3, 2014 at 8:52 PM, Ron Wheeler
<rw...@artifact-software.com> wrote:
> Why are you using the assembly-plugin?
> You normally don't need it to build jars.
>
>
>
>
> On 03/04/2014 5:24 AM, Li Li wrote:
>>
>> I want to jar my program with all the dependencies. I have a
>> dependency of hadoop. the log4j.properties is included in my
>> application.
>> how to exclude it?
>> I have tried this but no luck
>>
>> <artifactId>maven-assembly-plugin</artifactId>
>>     <configuration>
>>       <excludes>
>>       <exclude>**/log4j.properties</exclude>
>>       </excludes>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: rwheeler@artifact-software.com
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ---------------------------------------------------------------------
> 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 exclude log4j.properties when mvn assembly:single?

Posted by Ron Wheeler <rw...@artifact-software.com>.
Why are you using the assembly-plugin?
You normally don't need it to build jars.



On 03/04/2014 5:24 AM, Li Li wrote:
> I want to jar my program with all the dependencies. I have a
> dependency of hadoop. the log4j.properties is included in my
> application.
> how to exclude it?
> I have tried this but no luck
>
> <artifactId>maven-assembly-plugin</artifactId>
>     <configuration>
>       <excludes>
>       <exclude>**/log4j.properties</exclude>
>       </excludes>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


RE: how to exclude log4j.properties when mvn assembly:single?

Posted by Martin Gainty <mg...@hotmail.com>.
Li-

 

http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_dependencySet


<artifactId>maven-assembly-plugin</artifactId>

<configuration>

....

<dependencySets>
    <dependencySet>
      <excludes>
        <exclude>log4j:log4j</exclude>
      </excludes>
    </dependencySet>
  </dependencySets>

< /dependencySets>
........

</configuration>


although it might be easier to put <dependencySets> into ${project.basedir}/resources/assemblies/dependencySet-excludes.xml as seen here


<!--
  ~ Copyright 2001-2006 The Apache Software Foundation.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 
http://maven.apache.org/xsd/assembly-1.1.0.xsd">
  <id>dependencySet-excludes</id>
  <formats>

   <!-- zip, tar, or tar.gz -->
    <format>zip</format>
  </formats>

<dependencySets>
    <dependencySet>
      <excludes>
        <exclude>log4j:log4j</exclude>
      </excludes>
    </dependencySet>
  </dependencySets>

< /dependencySets>
........

</configuration>

</assembly>

  



> On Thu, Apr 3, 2014 at 9:15 PM, Li Li <fa...@gmail.com> wrote:
> 
> > seems very complicated, where shoud I put this file?
> >
> > On Fri, Apr 4, 2014 at 10:08 AM, Curtis Rueden <ct...@wisc.edu> wrote:
> > > Hi Li,
> > >
> > >> the log4j.properties is included in my application.
> > >> how to exclude it?
> > >
> > > Did you try with a custom assembly descriptor, and put the file in an
> > > <exclude> inside a <fileSet>?
> > >
> > > https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
> > >
> > > Regards,
> > > Curtis
> > >
> > >
> > > On Thu, Apr 3, 2014 at 4:24 AM, Li Li <fa...@gmail.com> wrote:
> > >
> > >> I want to jar my program with all the dependencies. I have a
> > >> dependency of hadoop. the log4j.properties is included in my
> > >> application.
> > >> how to exclude it?
> > >> I have tried this but no luck
> > >>
> > >> <artifactId>maven-assembly-plugin</artifactId>
> > >> <configuration>
> > >> <excludes>
> > >> <exclude>**/log4j.properties</exclude>
> > >> </excludes>
> > >>
> > >> ---------------------------------------------------------------------
> > >> 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 exclude log4j.properties when mvn assembly:single?

Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Li,

> seems very complicated

Well, assembly makes the simple easy, and the difficult possible. That is,
if all you want is to lump some JARs together, you can use the
preconfigured assembly descriptor. But as soon as you want to do something
custom, you have to create a custom descriptor. It takes a little while to
wrap your head around (I hated the assembly plugin at first) but once you
get into it, it is pretty powerful.

> where shoud I put this file?

You can put the file wherever you want. You configure its location in the
POM.

Here is a project with several assembly examples:
https://github.com/imagej/imagej/tree/imagej-2.0.0-beta-7.8/app

Regards,
Curtis


On Thu, Apr 3, 2014 at 9:15 PM, Li Li <fa...@gmail.com> wrote:

> seems very complicated, where shoud I put this file?
>
> On Fri, Apr 4, 2014 at 10:08 AM, Curtis Rueden <ct...@wisc.edu> wrote:
> > Hi Li,
> >
> >> the log4j.properties is included in my application.
> >> how to exclude it?
> >
> > Did you try with a custom assembly descriptor, and put the file in an
> > <exclude> inside a <fileSet>?
> >
> > https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
> >
> > Regards,
> > Curtis
> >
> >
> > On Thu, Apr 3, 2014 at 4:24 AM, Li Li <fa...@gmail.com> wrote:
> >
> >> I want to jar my program with all the dependencies. I have a
> >> dependency of hadoop. the log4j.properties is included in my
> >> application.
> >> how to exclude it?
> >> I have tried this but no luck
> >>
> >> <artifactId>maven-assembly-plugin</artifactId>
> >>    <configuration>
> >>      <excludes>
> >>      <exclude>**/log4j.properties</exclude>
> >>      </excludes>
> >>
> >> ---------------------------------------------------------------------
> >> 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 exclude log4j.properties when mvn assembly:single?

Posted by Li Li <fa...@gmail.com>.
seems very complicated, where shoud I put this file?

On Fri, Apr 4, 2014 at 10:08 AM, Curtis Rueden <ct...@wisc.edu> wrote:
> Hi Li,
>
>> the log4j.properties is included in my application.
>> how to exclude it?
>
> Did you try with a custom assembly descriptor, and put the file in an
> <exclude> inside a <fileSet>?
>
> https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
>
> Regards,
> Curtis
>
>
> On Thu, Apr 3, 2014 at 4:24 AM, Li Li <fa...@gmail.com> wrote:
>
>> I want to jar my program with all the dependencies. I have a
>> dependency of hadoop. the log4j.properties is included in my
>> application.
>> how to exclude it?
>> I have tried this but no luck
>>
>> <artifactId>maven-assembly-plugin</artifactId>
>>    <configuration>
>>      <excludes>
>>      <exclude>**/log4j.properties</exclude>
>>      </excludes>
>>
>> ---------------------------------------------------------------------
>> 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 exclude log4j.properties when mvn assembly:single?

Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Li,

> the log4j.properties is included in my application.
> how to exclude it?

Did you try with a custom assembly descriptor, and put the file in an
<exclude> inside a <fileSet>?

https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html

Regards,
Curtis


On Thu, Apr 3, 2014 at 4:24 AM, Li Li <fa...@gmail.com> wrote:

> I want to jar my program with all the dependencies. I have a
> dependency of hadoop. the log4j.properties is included in my
> application.
> how to exclude it?
> I have tried this but no luck
>
> <artifactId>maven-assembly-plugin</artifactId>
>    <configuration>
>      <excludes>
>      <exclude>**/log4j.properties</exclude>
>      </excludes>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>