You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rm...@apache.org on 2024/01/22 12:35:03 UTC
(maven-shade-plugin) branch master updated (4753d8e -> e7077c6)
This is an automated email from the ASF dual-hosted git repository.
rmannibucau pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git
from 4753d8e Bump org.codehaus.plexus:plexus-utils from 3.5.1 to 4.0.0
new 87a4f14 [MSHADE-467] Reproduce concurrency problem in an IT
new ae907a8 [MSHADE-467] Fix concurrency problem with dependency-reduced POM
new e7077c6 [MSHADE-467] Improved concurrency problem fix
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../invoker.properties | 2 +-
.../pom.xml | 184 +++++++++++++++++++++
.../shadeMT1}/pom.xml | 31 ++--
.../shadeMT2}/pom.xml | 31 ++--
.../shadeMT3}/pom.xml | 31 ++--
.../shadeMT4}/pom.xml | 31 ++--
.../verify.groovy | 9 +-
.../apache/maven/plugins/shade/mojo/ShadeMojo.java | 16 +-
8 files changed, 261 insertions(+), 74 deletions(-)
copy src/it/projects/{MSHADE-382_skip_execution => MSHADE-467_parallel-dependency-reduced-pom}/invoker.properties (96%)
create mode 100644 src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/pom.xml
copy src/it/projects/{MSHADE-413-parallel => MSHADE-467_parallel-dependency-reduced-pom/shadeMT1}/pom.xml (64%)
copy src/it/projects/{MSHADE-413-parallel => MSHADE-467_parallel-dependency-reduced-pom/shadeMT2}/pom.xml (64%)
copy src/it/projects/{MSHADE-413-parallel => MSHADE-467_parallel-dependency-reduced-pom/shadeMT3}/pom.xml (64%)
copy src/it/projects/{MSHADE-413-parallel => MSHADE-467_parallel-dependency-reduced-pom/shadeMT4}/pom.xml (64%)
copy src/it/projects/{MSHADE-382_skip_execution => MSHADE-467_parallel-dependency-reduced-pom}/verify.groovy (78%)
(maven-shade-plugin) 01/03: [MSHADE-467] Reproduce concurrency problem in an IT
Posted by rm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git
commit 87a4f14ef7e5ff898ec9dcb7ef47c71e31c448fd
Author: Alexander Kriegisch <Al...@Kriegisch.name>
AuthorDate: Sat Jan 20 13:03:50 2024 +0700
[MSHADE-467] Reproduce concurrency problem in an IT
---
.../invoker.properties | 18 ++
.../pom.xml | 184 +++++++++++++++++++++
.../shadeMT1/pom.xml | 38 +++++
.../shadeMT2/pom.xml | 38 +++++
.../shadeMT3/pom.xml | 38 +++++
.../shadeMT4/pom.xml | 38 +++++
.../verify.groovy | 25 +++
7 files changed, 379 insertions(+)
diff --git a/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/invoker.properties b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/invoker.properties
new file mode 100644
index 0000000..af49e5c
--- /dev/null
+++ b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = package -T 4
diff --git a/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/pom.xml b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/pom.xml
new file mode 100644
index 0000000..99be908
--- /dev/null
+++ b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/pom.xml
@@ -0,0 +1,184 @@
+<!--
+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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.shade.parallel</groupId>
+ <artifactId>MSHADE-467</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>shadeMT1</module>
+ <module>shadeMT2</module>
+ <module>shadeMT3</module>
+ <module>shadeMT4</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-vfs2</artifactId>
+ <version>2.9.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.vividsolutions</groupId>
+ <artifactId>jts</artifactId>
+ <version>1.13</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xercesImpl</groupId>
+ <artifactId>xerces</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.itextpdf</groupId>
+ <artifactId>itextpdf</artifactId>
+ <version>5.5.13.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlgraphics</groupId>
+ <artifactId>batik-swing</artifactId>
+ <version>1.17</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.xmlgraphics</groupId>
+ <artifactId>batik-ext</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlgraphics</groupId>
+ <artifactId>batik-dom</artifactId>
+ <version>1.17</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlgraphics</groupId>
+ <artifactId>batik-transcoder</artifactId>
+ <version>1.17</version>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>org.apache.avalon</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.xmlgraphics</groupId>
+ <artifactId>fop</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <version>2.7.18</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-core</artifactId>
+ <version>1.58.0</version>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-registry-stackdriver</artifactId>
+ <version>1.9.16</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot</artifactId>
+ <version>2.7.18</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.7.36</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>org.springframework.boot:*</include>
+ </includes>
+ </artifactSet>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT1/pom.xml b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT1/pom.xml
new file mode 100644
index 0000000..45a0388
--- /dev/null
+++ b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT1/pom.xml
@@ -0,0 +1,38 @@
+<!--
+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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.shade.parallel</groupId>
+ <artifactId>MSHADE-467</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>shadeMT1</artifactId>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-shade-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT2/pom.xml b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT2/pom.xml
new file mode 100644
index 0000000..c33b151
--- /dev/null
+++ b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT2/pom.xml
@@ -0,0 +1,38 @@
+<!--
+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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.shade.parallel</groupId>
+ <artifactId>MSHADE-467</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>shadeMT2</artifactId>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-shade-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT3/pom.xml b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT3/pom.xml
new file mode 100644
index 0000000..71d8394
--- /dev/null
+++ b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT3/pom.xml
@@ -0,0 +1,38 @@
+<!--
+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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.shade.parallel</groupId>
+ <artifactId>MSHADE-467</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>shadeMT3</artifactId>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-shade-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT4/pom.xml b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT4/pom.xml
new file mode 100644
index 0000000..792777b
--- /dev/null
+++ b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/shadeMT4/pom.xml
@@ -0,0 +1,38 @@
+<!--
+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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.shade.parallel</groupId>
+ <artifactId>MSHADE-467</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>shadeMT4</artifactId>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-shade-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/verify.groovy b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/verify.groovy
new file mode 100644
index 0000000..71ba38c
--- /dev/null
+++ b/src/it/projects/MSHADE-467_parallel-dependency-reduced-pom/verify.groovy
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+(1..4).each {
+ def exclusionCount = new File("$basedir/shadeMT$it/dependency-reduced-pom.xml")
+ .readLines()
+ .findAll { it.contains '<exclusion>' }
+ .size()
+ assert exclusionCount == 5
+} || true
(maven-shade-plugin) 02/03: [MSHADE-467] Fix concurrency problem with dependency-reduced POM
Posted by rm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git
commit ae907a870b8f585952a62eeaaa5a13fe6d7768ef
Author: Alexander Kriegisch <Al...@Kriegisch.name>
AuthorDate: Sat Jan 20 12:09:42 2024 +0700
[MSHADE-467] Fix concurrency problem with dependency-reduced POM
It looks as if running MShade concurrently somehow bleeds MavenSession
state into other mojo executions. Therefore, in the lower critical
section of ShadeMojo::rewriteDependencyReducedPomIfWeHaveReduction, we
use a final static ReentrantLock instance to block concurrent entry to
the section.
---
.../apache/maven/plugins/shade/mojo/ShadeMojo.java | 24 +++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
index 396bed1..3a7eaaa 100644
--- a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
@@ -35,6 +35,8 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
@@ -1048,6 +1050,8 @@ public class ShadeMojo extends AbstractMojo {
rewriteDependencyReducedPomIfWeHaveReduction(dependencies, modified, transitiveDeps, model);
}
+ private static final Lock LOCK = new ReentrantLock();
+
private void rewriteDependencyReducedPomIfWeHaveReduction(
List<Dependency> dependencies, boolean modified, List<Dependency> transitiveDeps, Model model)
throws IOException, ProjectBuildingException, DependencyGraphBuilderException {
@@ -1112,15 +1116,21 @@ public class ShadeMojo extends AbstractMojo {
w.close();
}
- ProjectBuildingRequest projectBuildingRequest =
- new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
- projectBuildingRequest.setLocalRepository(session.getLocalRepository());
- projectBuildingRequest.setRemoteRepositories(project.getRemoteArtifactRepositories());
+ // Lock critical section to fix MSHADE-467
+ try {
+ LOCK.lock();
+ ProjectBuildingRequest projectBuildingRequest =
+ new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
+ projectBuildingRequest.setLocalRepository(session.getLocalRepository());
+ projectBuildingRequest.setRemoteRepositories(project.getRemoteArtifactRepositories());
- ProjectBuildingResult result = projectBuilder.build(f, projectBuildingRequest);
+ ProjectBuildingResult result = projectBuilder.build(f, projectBuildingRequest);
- getLog().debug("updateExcludesInDeps()");
- modified = updateExcludesInDeps(result.getProject(), dependencies, transitiveDeps);
+ getLog().debug("updateExcludesInDeps()");
+ modified = updateExcludesInDeps(result.getProject(), dependencies, transitiveDeps);
+ } finally {
+ LOCK.unlock();
+ }
}
project.setFile(dependencyReducedPomLocation);
(maven-shade-plugin) 03/03: [MSHADE-467] Improved concurrency problem fix
Posted by rm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shade-plugin.git
commit e7077c628c2cbb059c829ffb124690f211ba36b0
Author: Alexander Kriegisch <Al...@Kriegisch.name>
AuthorDate: Sun Jan 21 03:44:15 2024 +0700
[MSHADE-467] Improved concurrency problem fix
Code review: Synchronising on session.getProjectBuildingRequest() is
less invasive than a global reentrant lock and therefore preferable to
the reviewer.
Co-authored-by: Romain Manni-Bucau <rm...@gmail.com>
---
.../java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
index 3a7eaaa..a8475d9 100644
--- a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
@@ -35,8 +35,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
@@ -1050,8 +1048,6 @@ public class ShadeMojo extends AbstractMojo {
rewriteDependencyReducedPomIfWeHaveReduction(dependencies, modified, transitiveDeps, model);
}
- private static final Lock LOCK = new ReentrantLock();
-
private void rewriteDependencyReducedPomIfWeHaveReduction(
List<Dependency> dependencies, boolean modified, List<Dependency> transitiveDeps, Model model)
throws IOException, ProjectBuildingException, DependencyGraphBuilderException {
@@ -1116,9 +1112,7 @@ public class ShadeMojo extends AbstractMojo {
w.close();
}
- // Lock critical section to fix MSHADE-467
- try {
- LOCK.lock();
+ synchronized (session.getProjectBuildingRequest()) { // Lock critical section to fix MSHADE-467
ProjectBuildingRequest projectBuildingRequest =
new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
projectBuildingRequest.setLocalRepository(session.getLocalRepository());
@@ -1128,8 +1122,6 @@ public class ShadeMojo extends AbstractMojo {
getLog().debug("updateExcludesInDeps()");
modified = updateExcludesInDeps(result.getProject(), dependencies, transitiveDeps);
- } finally {
- LOCK.unlock();
}
}