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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to