Jcstress jopt-simple jar shaded
Jerzy Krolak
j.krolak at gmail.com
Wed Oct 3 10:13:50 UTC 2018
Hi all,
When I run a jcstress suite in a project that already uses jopt-simple, it
breaks on version mismatch.
The jopt-simple jar could be shaded / relocated to a different package so
that it doesn't interfere with the app it tests.
I've attached a sample patch where jopt-simple jar gets published as
org.openjdk.jcstress:jcstress-shaded-jopt-simple . Could you have a look at
it?
Thank you,
Jerzy
-------------- next part --------------
Index: jcstress-core/src/main/java/org/openjdk/jcstress/util/OptionFormatter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- jcstress-core/src/main/java/org/openjdk/jcstress/util/OptionFormatter.java (revision 418:ff7cf32e69503147d18c13768b7cc2ec7bf5b924)
+++ jcstress-core/src/main/java/org/openjdk/jcstress/util/OptionFormatter.java (revision 418+:ff7cf32e6950+)
@@ -24,8 +24,8 @@
*/
package org.openjdk.jcstress.util;
-import joptsimple.HelpFormatter;
-import joptsimple.OptionDescriptor;
+import org.openjdk.jcstress.shaded.joptsimple.HelpFormatter;
+import org.openjdk.jcstress.shaded.joptsimple.OptionDescriptor;
import java.util.ArrayList;
import java.util.Collection;
Index: jcstress-core/src/main/java/org/openjdk/jcstress/Options.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- jcstress-core/src/main/java/org/openjdk/jcstress/Options.java (revision 418:ff7cf32e69503147d18c13768b7cc2ec7bf5b924)
+++ jcstress-core/src/main/java/org/openjdk/jcstress/Options.java (revision 418+:ff7cf32e6950+)
@@ -24,11 +24,11 @@
*/
package org.openjdk.jcstress;
-import joptsimple.OptionException;
-import joptsimple.OptionParser;
-import joptsimple.OptionSet;
-import joptsimple.OptionSpec;
import org.openjdk.jcstress.infra.runners.SpinLoopStyle;
+import org.openjdk.jcstress.shaded.joptsimple.OptionException;
+import org.openjdk.jcstress.shaded.joptsimple.OptionParser;
+import org.openjdk.jcstress.shaded.joptsimple.OptionSet;
+import org.openjdk.jcstress.shaded.joptsimple.OptionSpec;
import org.openjdk.jcstress.util.OptionFormatter;
import org.openjdk.jcstress.util.Promise;
import org.openjdk.jcstress.util.StringUtils;
Index: jcstress-core/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- jcstress-core/pom.xml (revision 418:ff7cf32e69503147d18c13768b7cc2ec7bf5b924)
+++ jcstress-core/pom.xml (revision 418+:ff7cf32e6950+)
@@ -174,8 +174,8 @@
<dependencies>
<dependency>
- <groupId>net.sf.jopt-simple</groupId>
- <artifactId>jopt-simple</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>jcstress-shaded-jopt-simple</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
Index: pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- pom.xml (revision 418:ff7cf32e69503147d18c13768b7cc2ec7bf5b924)
+++ pom.xml (revision 418+:ff7cf32e6950+)
@@ -284,8 +284,8 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>net.sf.jopt-simple</groupId>
- <artifactId>jopt-simple</artifactId>
+ <groupId>org.openjdk.jcstress</groupId>
+ <artifactId>jcstress-shaded-jopt-simple</artifactId>
<version>4.6</version>
</dependency>
<dependency>
Index: jcstress-shaded-jopt-simple/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- jcstress-shaded-jopt-simple/pom.xml (revision 418+:ff7cf32e6950+)
+++ jcstress-shaded-jopt-simple/pom.xml (revision 418+:ff7cf32e6950+)
@@ -0,0 +1,134 @@
+<!--
+Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openjdk.jcstress</groupId>
+ <artifactId>jcstress-parent</artifactId>
+ <version>0.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>jcstress-shaded-jopt-simple</artifactId>
+ <packaging>jar</packaging>
+ <version>4.6</version>
+
+ <name>JCStress shaded JOpt Simple library</name>
+ <url>http://maven.apache.org</url>
+
+ <scm>
+ <connection>scm:hg:http://hg.openjdk.java.net/code-tools/jcstress/</connection>
+ </scm>
+
+ <properties>
+ <!-- skip source archives -->
+ <assembly.attach>false</assembly.attach>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <skipSource>true</skipSource>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.mycila.maven-license-plugin</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ </plugin>
+ <plugin> <!-- deploy this artifact -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.4.3</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <createSourcesJar>true</createSourcesJar>
+ <shadeSourcesContent>true</shadeSourcesContent>
+ <artifactSet>
+ <includes>
+ <include>net.sf.jopt-simple:*</include>
+ </includes>
+ </artifactSet>
+ <relocations>
+ <relocation>
+ <pattern>joptsimple</pattern>
+ <shadedPattern>org.openjdk.jcstress.shaded.joptsimple</shadedPattern>
+ </relocation>
+ </relocations>
+ <dependencyReducedPomLocation>target/reduced-pom.xml</dependencyReducedPomLocation>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>flatten-maven-plugin</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <outputDirectory>${project.basedir}/target</outputDirectory>
+ <flattenMode>clean</flattenMode>
+ <pomElements><name/></pomElements>
+ </configuration>
+ <executions>
+ <execution>
+ <id>flatten</id>
+ <phase>package</phase>
+ <goals>
+ <goal>flatten</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.jopt-simple</groupId>
+ <artifactId>jopt-simple</artifactId>
+ <version>4.6</version>
+ </dependency>
+ </dependencies>
+</project>
More information about the jcstress-dev
mailing list