[Comment Edited] (MJAR-224) Not possible to exclude classes from primary jar only

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Comment Edited] (MJAR-224) Not possible to exclude classes from primary jar only

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/MJAR-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16251760#comment-16251760 ]

Tomasz Majchrowski edited comment on MJAR-224 at 11/14/17 5:17 PM:
-------------------------------------------------------------------

Hi Karl-Heinz,

Thanks for sharing info. Unfortunately I was not able to get expected content of the jars with using of sibling configuration to the one provided in your example:

{code}
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>com/foo/migration/**</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>build-migration-jar</id>
                        <goals>
                          <goal>jar</goal>
                        </goals>
                        <configuration>
                          <includes>
                            <include>com/foo/migration/**/*</include>
                          </includes>
                          <classifier>migration</classifier>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
{code}

Outcome:
{code}
foo-1.0.2-SNAPSHOT.jar: contains complete set of compiled classes
foo-1.0.2-SNAPSHOT-migration.jar: contains subset com/foo/migration/*
{code}

Expected outcome:
{code}
foo-1.0.2-SNAPSHOT.jar: contains complete set except: subset com/foo/migration/*
foo-1.0.2-SNAPSHOT-migration.jar: contains subset com/foo/migration/*
{code}

Env:
{code}
Apache Maven 3.3.3 ; maven-jar-plugin-3.0.2; CentOS Linux release 7.3.1611; java version "1.8.0_131"
{code}

Could you comment on that ? Thanks, Tomasz


was (Author: tomaszm):
Hi Karl-Heinz,

Thanks for sharing info. Unfortunately I was not able to get expected content of the jar with using of sibling configuration to one provided in your example:

{code}
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>com/foo/migration/**</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>build-migration-jar</id>
                        <goals>
                          <goal>jar</goal>
                        </goals>
                        <configuration>
                          <includes>
                            <include>com/foo/migration/**/*</include>
                          </includes>
                          <classifier>migration</classifier>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
{code}

Outcome:
{code}
foo-1.0.2-SNAPSHOT.jar: contains complete set of compiled classes
foo-1.0.2-SNAPSHOT.jar-migration: contains subset com/foo/migration/*
{code}

Expected outcome:
{code}
foo-1.0.2-SNAPSHOT.jar: contains complete set except: subset com/foo/migration/*
foo-1.0.2-SNAPSHOT.jar-migration: contains subset com/foo/migration/*
{code}

Env:
{code}
Apache Maven 3.3.3 ; maven-jar-plugin-3.0.2; CentOS Linux release 7.3.1611; java version "1.8.0_131"
{code}

Could you comment on that ? Thanks, Tomasz

> Not possible to exclude classes from primary jar only
> -----------------------------------------------------
>
>                 Key: MJAR-224
>                 URL: https://issues.apache.org/jira/browse/MJAR-224
>             Project: Maven JAR Plugin
>          Issue Type: Bug
>            Reporter: Sebb
>            Assignee: Karl Heinz Marbaise
>
> The <excludes> config item can be used to exclude classes from a jar.
> However, if this is done for the main jar, the exclusion also applies to any other jars created with a different classifier.
> It does not appear to be possible to exclude a class from the main jar and include it in any others.
> This forces the use of other solutions such a the Maven Antrun Plugin



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)