You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stefan Miklosovic <sm...@redhat.com> on 2015/01/29 21:25:27 UTC

How to exclude directory in Maven in basedir from adding sources to release?

Hi,

I have parent pom.xml and I have modules there, structure is like this:

pom.xml
module1/
module2/
module3/
some_dir1/
some_dir2/
README.adoc

When I want to release this project, I do it like

mvn release:prepare release:perform

What it does is that when I look into sources of parent project (pom.xml project), I can see that sources-release.zip contains all directories including some_dir1, some_dir2 and README.adoc

I want to exclude these directories and README.adoc from being in resulting parent sources release zip.

My initial approach was like this in root pom.xml

<build>
    <resources>
        <resource>
            <directory>${project.basedir}</directory>
            <excludes>
                <exclude>some_dir1/*</exclude>
                <exclude>some_dir2/*</exclude>
                <exclude>README.adoc</exclude>
            </excludes>
        </resource>
    </resources>        
</build>

But that fails. The first module1 said that:

Failed to execute goal org.apache.maven.plugins:maven-source-plugin:2.2.1:jar-no-fork (attach-sources) on project module1: Error creating source archive: A zip file cannot include itself -> [Help 1]

How do I get rid of these directories in a resulting sources release zip archive?

Thanks!

Stefan Miklosovic
Red Hat Brno - JBoss Mobile Platform

e-mail: smikloso@redhat.com
irc: smikloso

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


Re: How to exclude directory in Maven in basedir from adding sources torelease?

Posted by Stefan Miklosovic <sm...@redhat.com>.
It helped in order to build that and deploy it to staging area, however when I look into that zip, these folders and file are still there.

Stefan Miklosovic
Red Hat Brno - JBoss Mobile Platform

e-mail: smikloso@redhat.com
irc: smikloso

----- Original Message -----
> In your case you need to also exclude the target/ directory.
> 
>  However I am not sure if that kind of resource 'abuse' should be done.
> 
> --
> http://bernd.eckenfels.net
> 
> ----- Ursprüngliche Nachricht -----
> Von: "Stefan Miklosovic" <sm...@redhat.com>
> Gesendet: ‎29.‎01.‎2015 21:26
> An: "Maven Users List" <us...@maven.apache.org>
> Betreff: How to exclude directory in Maven in basedir from adding sources
> torelease?
> 
> Hi,
> 
> I have parent pom.xml and I have modules there, structure is like this:
> 
> pom.xml
> module1/
> module2/
> module3/
> some_dir1/
> some_dir2/
> README.adoc
> 
> When I want to release this project, I do it like
> 
> mvn release:prepare release:perform
> 
> What it does is that when I look into sources of parent project (pom.xml
> project), I can see that sources-release.zip contains all directories
> including some_dir1, some_dir2 and README.adoc
> 
> I want to exclude these directories and README.adoc from being in resulting
> parent sources release zip.
> 
> My initial approach was like this in root pom.xml
> 
> <build>
>     <resources>
>         <resource>
>             <directory>${project.basedir}</directory>
>             <excludes>
>                 <exclude>some_dir1/*</exclude>
>                 <exclude>some_dir2/*</exclude>
>                 <exclude>README.adoc</exclude>
>             </excludes>
>         </resource>
>     </resources>
> </build>
> 
> But that fails. The first module1 said that:
> 
> Failed to execute goal
> org.apache.maven.plugins:maven-source-plugin:2.2.1:jar-no-fork
> (attach-sources) on project module1: Error creating source archive: A zip
> file cannot include itself -> [Help 1]
> 
> How do I get rid of these directories in a resulting sources release zip
> archive?
> 
> Thanks!
> 
> Stefan Miklosovic
> Red Hat Brno - JBoss Mobile Platform
> 
> e-mail: smikloso@redhat.com
> irc: smikloso
> 
> ---------------------------------------------------------------------
> 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 directory in Maven in basedir from adding sources torelease?

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
In your case you need to also exclude the target/ directory.

 However I am not sure if that kind of resource 'abuse' should be done.

-- 
http://bernd.eckenfels.net

----- Ursprüngliche Nachricht -----
Von: "Stefan Miklosovic" <sm...@redhat.com>
Gesendet: ‎29.‎01.‎2015 21:26
An: "Maven Users List" <us...@maven.apache.org>
Betreff: How to exclude directory in Maven in basedir from adding sources torelease?

Hi,

I have parent pom.xml and I have modules there, structure is like this:

pom.xml
module1/
module2/
module3/
some_dir1/
some_dir2/
README.adoc

When I want to release this project, I do it like

mvn release:prepare release:perform

What it does is that when I look into sources of parent project (pom.xml project), I can see that sources-release.zip contains all directories including some_dir1, some_dir2 and README.adoc

I want to exclude these directories and README.adoc from being in resulting parent sources release zip.

My initial approach was like this in root pom.xml

<build>
    <resources>
        <resource>
            <directory>${project.basedir}</directory>
            <excludes>
                <exclude>some_dir1/*</exclude>
                <exclude>some_dir2/*</exclude>
                <exclude>README.adoc</exclude>
            </excludes>
        </resource>
    </resources>        
</build>

But that fails. The first module1 said that:

Failed to execute goal org.apache.maven.plugins:maven-source-plugin:2.2.1:jar-no-fork (attach-sources) on project module1: Error creating source archive: A zip file cannot include itself -> [Help 1]

How do I get rid of these directories in a resulting sources release zip archive?

Thanks!

Stefan Miklosovic
Red Hat Brno - JBoss Mobile Platform

e-mail: smikloso@redhat.com
irc: smikloso

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