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

ASF GitHub Bot commented on MJAR-296:
-------------------------------------

michael-o commented on code in PR #67:
URL: https://github.com/apache/maven-jar-plugin/pull/67#discussion_r1557063948


##########
src/it/MJAR-296-exclude-default/setup.groovy:
##########
@@ -0,0 +1,29 @@
+import java.nio.file.Files
+import java.nio.file.Paths
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// excluded files are not copied by m-invoker-p - so we need create one
+
+def resDir = basedir.toPath().resolve("src/main/resources")
+Files.createDirectories(resDir)
+Files.createFile(resDir.resolve(".cvsignore"))
+
+return true

Review Comment:
   Why not simply add them to revision control instead of creating them?



##########
src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java:
##########
@@ -169,6 +170,38 @@ public abstract class AbstractJarMojo extends AbstractMojo 
{
     @Parameter(property = "maven.jar.detectMultiReleaseJar", defaultValue = 
"true")
     private boolean detectMultiReleaseJar;
 
+    /**
+     * If set to {@code false}, the files that by default are excluded from 
the resulting archive,

Review Comment:
   files and directories



##########
src/it/MJAR-296-exclude-default/pom.xml:
##########
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>mjar-296-exclude-default</artifactId>
+  <name>mjar-296-suppress-default-excludes</name>
+  <description>Verifies that the resulting jar not includes files excluded by 
default</description>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    
<project.build.outputTimestamp>2023-11-19T13:25:58Z</project.build.outputTimestamp>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-resources-plugin</artifactId>
+          <version>@version.maven-resources-plugin@</version>
+          <configuration>
+            <addDefaultExcludes>false</addDefaultExcludes>

Review Comment:
   I wonder why this is `false`, but the `.cvsignore` is excluded`





> No way to suppress default excludes in maven-jar-plugin
> -------------------------------------------------------
>
>                 Key: MJAR-296
>                 URL: https://issues.apache.org/jira/browse/MJAR-296
>             Project: Maven JAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 3.3.0
>            Reporter: G.Vaysman
>            Assignee: Slawomir Jaranowski
>            Priority: Major
>             Fix For: 3.4.0
>
>         Attachments: jar-default-excludes.zip
>
>
> With the default excludes being expanded further (see 
> org.codehaus.plexus.util.AbstractScanner.{*}_DEFAULTEXCLUDES_{*}), a resource 
> directory **/ChangeSet/** will never be included in the JAR artifact.
> Some plugins (maven-resources-plugin, maven-assembly-plugin) already allow 
> suppressing the exclusion, but not the maven-jar-plugin. Code analysis of the 
> JarMojo -> DirectoryScanner call path confirms that there is no way to affect 
> the FileSet configuration. 
> Again, with ever expanding list of *_DEFAULTEXCLUDES,_* this, on our opinion, 
> is quite detrimental, and due to backward compatibility, changing 
> resource/package path (say, to ChangeSet2) is not an option. 
> I am attaching a very simple project that shows two things:
>  # The jar plugin skips adding the **/ChangeSet/** files
>  # The resources plugin is configured not to skip (addDefaultExcludes) and 
> behaves properly



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to