You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "rcasta74 (via GitHub)" <gi...@apache.org> on 2025/12/18 12:22:56 UTC

[I] Skip jar creation when no existing files will be included [maven-jar-plugin]

rcasta74 opened a new issue, #510:
URL: https://github.com/apache/maven-jar-plugin/issues/510

   ### New feature, improvement proposal
   
   Hello,
   
   my understanding is that with `skipIfEmpty=true` will skip jar creation when src path does not exist or it does not contain any file.
   It would be usefull if the above option could be used  to skip jar creation also when no files will be included.
   
   [example.zip](https://github.com/user-attachments/files/24235079/example.zip)
   
   In the attached example i have create the following possible use case:
   ```
   example
   ├── module1
   │   ├── pom.xml
   │   └── src
   │       ├── main
   │       │   └── java
   │       │       └── my
   │       │           └── org
   │       │               └── app1
   │       │                   └── App1.java
   │       └── test
   │           └── java
   │               └── my
   │                   └── org
   │                       └── app1
   │                           ├── App1Test.java
   │                           └── junit
   │                               ├── MyExtension.java
   │                               └── MyExtensionTest.java
   ├── module2
   │   ├── pom.xml
   │   └── src
   │       ├── main
   │       │   └── java
   │       │       └── my
   │       │           └── org
   │       │               └── app2
   │       │                   └── App2.java
   │       └── test
   │           └── java
   │               └── my
   │                   └── org
   │                       └── app2
   │                           └── App2Test.java
   └── pom.xml
   ```
   where parent pom contains:
   ```
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-jar-plugin</artifactId>
           <version>3.5.0</version>
           <executions>
             <execution>
               <configuration>
                 <classifier>junit</classifier>
                 <skipIfEmpty>true</skipIfEmpty>
                 <includes>
                     <include>**/junit/*</include>
                 </includes>
                 <excludes>
                     <exclude>**/*Test.class</exclude>
                 </excludes>
               </configuration>
               <goals>
                 <goal>test-jar</goal>
               </goals>
             </execution>
           </executions>
         </plugin>
   ```
   In the above scenario I would expect that junit jar will be created only for app1, while now it is created also for app2 with only pom and manifest files
   ```
   ❯ unzip -l module2/target/app2-1.0-junit.jar
   Archive:  module2/target/app2-1.0-junit.jar
     Length      Date    Time    Name
   ---------  ---------- -----   ----
           0  2025-12-18 13:13   META-INF/
          81  2025-12-18 13:13   META-INF/MANIFEST.MF
           0  2025-12-18 13:13   META-INF/maven/
           0  2025-12-18 13:13   META-INF/maven/my.org/
           0  2025-12-18 13:13   META-INF/maven/my.org/app2/
         515  2025-12-18 10:48   META-INF/maven/my.org/app2/pom.xml
          43  2025-12-18 13:13   META-INF/maven/my.org/app2/pom.properties
   ---------                     -------
         639                     7 files
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Skip jar creation when no existing files will be included [maven-jar-plugin]

Posted by "AzazelSensei (via GitHub)" <gi...@apache.org>.
AzazelSensei commented on issue #510:
URL: https://github.com/apache/maven-jar-plugin/issues/510#issuecomment-5435849784

   Opened https://github.com/apache/maven-jar-plugin/pull/588


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Skip jar creation when no existing files will be included [maven-jar-plugin]

Posted by "AzazelSensei (via GitHub)" <gi...@apache.org>.
AzazelSensei commented on issue #510:
URL: https://github.com/apache/maven-jar-plugin/issues/510#issuecomment-5435853083

   Opened https://github.com/apache/maven-jar-plugin/pull/591


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Skip jar creation when no existing files will be included [maven-jar-plugin]

Posted by "desruisseaux (via GitHub)" <gi...@apache.org>.
desruisseaux commented on issue #510:
URL: https://github.com/apache/maven-jar-plugin/issues/510#issuecomment-5622653779

   Same as #591, but rewritten for the new JAR plugin implementation: #598.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Skip jar creation when no existing files will be included [maven-jar-plugin]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on issue #510:
URL: https://github.com/apache/maven-jar-plugin/issues/510#issuecomment-5057569514

   seems reasonable. It would be helpful to send this as a PR instead of a patch. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Skip jar creation when no existing files will be included [maven-jar-plugin]

Posted by "desruisseaux (via GitHub)" <gi...@apache.org>.
desruisseaux commented on issue #510:
URL: https://github.com/apache/maven-jar-plugin/issues/510#issuecomment-5812795570

   Fixed in 4.0.0-beta-2.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Skip jar creation when no existing files will be included [maven-jar-plugin]

Posted by "rcasta74 (via GitHub)" <gi...@apache.org>.
rcasta74 commented on issue #510:
URL: https://github.com/apache/maven-jar-plugin/issues/510#issuecomment-3670772750

   My proposed commit a5a5615 (against `maven-jar-plugin-3.x` branch).
   
   I don't understand why `createArchive` method is `public`, so I don't know if changing its behaviour (return `null` object if creation was skipped) may break somethig else.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Skip jar creation when no existing files will be included [maven-jar-plugin]

Posted by "desruisseaux (via GitHub)" <gi...@apache.org>.
desruisseaux closed issue #510: Skip jar creation when no existing files will be included
URL: https://github.com/apache/maven-jar-plugin/issues/510


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org