[ 
http://jira.codehaus.org/browse/MJAR-106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=131688#action_131688
 ] 

Benjamin Bentmann commented on MJAR-106:
----------------------------------------

bq. It doesn't work.
But it works for me so there must be something about your configuration. Could 
you please attach a demo project and the command lines to invoke to allow to 
reproduce your problem?

bq. Why is jar:jar being invoked twice? I assume it's because I defined the 
execution goal jar.
Right, you added an additional {{<execution>}} for the {{jar}} goal. The first 
execution is the default execution defined by the [lifecycle for packaging 
"jar"|http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Built-in_Lifecycle_Bindings].

bq. And why aren't the excludes used for the first jar:jar call??
The {{<configuration>}} element inside an {{<execution>}} element applies only 
to this particular execution. However as stated above, the first invocation of 
the goal does not originate from the {{<execution>}} element. Compare the 
section [Using executions 
tag|http://maven.apache.org/guides/mini/guide-configuring-plugins.html].

> Excludes do not work as described on the Usage page
> ---------------------------------------------------
>
>                 Key: MJAR-106
>                 URL: http://jira.codehaus.org/browse/MJAR-106
>             Project: Maven 2.x Jar Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Michael Mattox
>
> The jar plugin usage page gives an example:
> {code:xml}
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-jar-plugin</artifactId>
>         <configuration>
>           <includes>
>             <include>**/service/*</include>
>           </includes>
>         </configuration>
>       </plugin>
> {code}
> If I use excludes, such as this:
> {code:xml}
>                                               <configuration>
>                                                       <excludes>
>                                                               
> <exclude>**/*.properties</exclude>
>                                                       </excludes>
>                                               </configuration>
> {code}
> It doesn't work.  I get the properties in both my jar and my -tests.jar.  
> However, if I add executions to the plugin configuration, like this:
> {code:xml}
>                       <plugin>
>                               <groupId>org.apache.maven.plugins</groupId>
>                               <artifactId>maven-jar-plugin</artifactId>
>                               <executions>
>                                       <execution>
>                                               <goals>
>                                                       <goal>jar</goal>
>                                               </goals>
>                                               <configuration>
>                                                       <excludes>
>                                                               
> <exclude>**/*.properties</exclude>
>                                                       </excludes>
>                                               </configuration>
>                                       </execution>
>                               </executions>
>                       </plugin>
> {code}
> Then the properties are excluded form my test jar but NOT from my regular 
> jar.  Here is some debug output:
> {noformat}
> [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jar-plugin:2.2:jar' 
> -->
> [DEBUG]   (f) classesDirectory = 
> C:\projects\company\projects\pam\workspace\mm-config\target\classes
> [DEBUG]   (f) defaultManifestFile = 
> C:\projects\company\projects\pam\workspace\mm-config\target\classes\META-INF\MANIFEST.MF
> [DEBUG]   (f) finalName = mm-config-1.0-SNAPSHOT
> [DEBUG]   (f) forceCreation = false
> [DEBUG]   (f) outputDirectory = 
> C:\projects\company\projects\pam\workspace\mm-config\target
> [DEBUG]   (f) project = MavenProject: company:mm-config:1.0-SNAPSHOT @ 
> C:\projects\company\projects\pam\workspace\mm-config\pom.xml
> [DEBUG]   (f) useDefaultManifestFile = false
> [DEBUG] -- end configuration --
> [INFO] [jar:jar]
> [DEBUG] isUp2date: false (Destination 
> C:\projects\company\projects\pam\workspace\mm-config\target\mm-config-1.0-SNAPSHOT.jar
>  not found.)
> [INFO] Building jar: 
> C:\projects\company\projects\pam\workspace\mm-config\target\mm-config-1.0-SNAPSHOT.jar
> [DEBUG] adding directory META-INF/
> [DEBUG] adding entry META-INF/MANIFEST.MF
> [DEBUG] adding directory commons/
> [DEBUG] adding entry commons/applicationContext.xml
> [DEBUG] adding entry database.properties
> [DEBUG] adding entry log4j.xml
> [DEBUG] adding entry messages-exceptions-commons.properties
> [DEBUG] adding entry messages-warnings-commons.properties
> [DEBUG] adding entry mm2-rmi.properties
> [DEBUG] adding directory META-INF/maven/
> [DEBUG] adding directory META-INF/maven/company/
> [DEBUG] adding directory META-INF/maven/company/mm-config/
> [DEBUG] adding entry META-INF/maven/company/mm-config/pom.xml
> [DEBUG] adding entry META-INF/maven/company/mm-config/pom.properties
> [DEBUG] company:mm-config:jar:1.0-SNAPSHOT (selected for null)
> [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-jar-plugin:2.2:jar' 
> -->
> [DEBUG]   (f) classesDirectory = 
> C:\projects\company\projects\pam\workspace\mm-config\target\classes
> [DEBUG]   (f) defaultManifestFile = 
> C:\projects\company\projects\pam\workspace\mm-config\target\classes\META-INF\MANIFEST.MF
> [DEBUG]   (f) excludes = [Ljava.lang.String;@24dd07a
> [DEBUG]   (f) finalName = mm-config-1.0-SNAPSHOT
> [DEBUG]   (f) forceCreation = false
> [DEBUG]   (f) outputDirectory = 
> C:\projects\company\projects\pam\workspace\mm-config\target
> [DEBUG]   (f) project = MavenProject: company:mm-config:1.0-SNAPSHOT @ 
> C:\projects\company\projects\pam\workspace\mm-config\pom.xml
> [DEBUG]   (f) useDefaultManifestFile = false
> [DEBUG] -- end configuration --
> [INFO] [jar:jar {execution: default}]
> [DEBUG] isUp2date: true
> [DEBUG] Archive 
> C:\projects\company\projects\pam\workspace\mm-config\target\mm-config-1.0-SNAPSHOT.jar
>  is uptodate.
> [DEBUG] company:mm-config:jar:1.0-SNAPSHOT (selected for null)
> [DEBUG] Configuring mojo 
> 'org.apache.maven.plugins:maven-jar-plugin:2.2:test-jar' -->
> [DEBUG]   (f) defaultManifestFile = 
> C:\projects\company\projects\pam\workspace\mm-config\target\classes\META-INF\MANIFEST.MF
> [DEBUG]   (f) excludes = [Ljava.lang.String;@24e7541
> [DEBUG]   (f) finalName = mm-config-1.0-SNAPSHOT
> [DEBUG]   (f) forceCreation = false
> [DEBUG]   (f) outputDirectory = 
> C:\projects\company\projects\pam\workspace\mm-config\target
> [DEBUG]   (f) project = MavenProject: company:mm-config:1.0-SNAPSHOT @ 
> C:\projects\company\projects\pam\workspace\mm-config\pom.xml
> [DEBUG]   (f) testClassesDirectory = 
> C:\projects\company\projects\pam\workspace\mm-config\target\test-classes
> [DEBUG]   (f) useDefaultManifestFile = false
> [DEBUG] -- end configuration --
> [INFO] [jar:test-jar {execution: default}]
> [DEBUG] isUp2date: false (Destination 
> C:\projects\company\projects\pam\workspace\mm-config\target\mm-config-1.0-SNAPSHOT-tests.jar
>  not found.)
> [INFO] Building jar: 
> C:\projects\company\projects\pam\workspace\mm-config\target\mm-config-1.0-SNAPSHOT-tests.jar
> [DEBUG] adding directory META-INF/
> [DEBUG] adding entry META-INF/MANIFEST.MF
> [DEBUG] adding directory commons/
> [DEBUG] adding entry commons/applicationContext.xml
> [DEBUG] adding entry log4j.xml
> [DEBUG] adding directory META-INF/maven/
> [DEBUG] adding directory META-INF/maven/company/
> [DEBUG] adding directory META-INF/maven/company/mm-config/
> [DEBUG] adding entry META-INF/maven/company/mm-config/pom.xml
> [DEBUG] adding entry META-INF/maven/company/mm-config/pom.properties
> {noformat}
> The other thing I don't understand with this approach is that the jar plugin 
> is configured twice.  First without excludes and the second time with 
> excludes.  The second time the plugin says the jar is up to date.  Why is 
> jar:jar being invoked twice?  I assume it's because I defined the execution 
> goal jar.  
> And why aren't the excludes used for the first jar:jar call??

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to