Detecting plagiarism made easy.

Score: 0.8116776347160339; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2023-01-18
by Thend

Original Post

Original - Posted on 2010-09-22
by Vijay Katam

Present in both answers; Present only in the new answer; Present only in the old answer;

After several hard day, I was able to create the executable jar. I'd like to share the know-how with you.
After 5th step, skipping the WinRAR for removing the *.SF, *.DSA and *.RSA files. I added `maven-shade-plugin` to my pom.xml. The shade plugin can automatically remove these unwanted files, but unfortunately by itself cannot create a runnable JAR, because throws again exceptions and doesn't run on double click (
To avoid this exception and include the unlocated/missing JavaFX files we have to repack the already packed JAR. To do that, I used the `spring-boot-maven-plugin`. After setting up the plugins (code below), you have to run the plugins with maven in a correct order! My maven command was the following: `mvn clean package spring-boot:repackage`
That it, finally the created JAR (JAR of the JAR) can run on double click.
My pom.xml's corresponding parts: 1. Shade plugin setting:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.4.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>controller.Start</mainClass> </transformer>
</transformers> <minimizeJar>true</minimizeJar> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> </configuration> </execution> </executions> </plugin>
2. The Spring-boot-maven-plugin setting (this should be placed outside the plugins section, at the very end of the pom.xml):
<pluginManagement> <plugins> <plugin> <!-- mvn clean package spring-boot:repackage --> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> <configuration> <classifier>spring-boot</classifier> <mainClass> controller.Start </mainClass> </configuration> </execution> </executions> </plugin> </plugins> </pluginManagement>

Make sure to run the plugins in the correct order, as mentioned above!
Use the *maven-shade-plugin* to package all dependencies into one über-JAR file. It can also be used to build an executable JAR file by specifying the main class. After trying to use maven-assembly and maven-jar, I found that this plugin best suited my needs.
I found this plugin particularly useful as it merges the content of specific files instead of overwriting them. This is needed when there are resource files that are have the same name across the JAR files and the plugin tries to package all the resource files.
See the example below:
<plugins> <!-- This plugin provides the capability to package the artifact in an über-JAR file, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <artifactSet> <!-- Signed JAR files--> <excludes> <exclude>bouncycastle:bcprov-jdk15</exclude> </excludes> </artifactSet>
<transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <!-- Main class --> <mainClass>com.main.MyMainClass</mainClass> </transformer>
<!-- Use resource transformers to prevent file overwrites --> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource></resource> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer"> <resource>applicationContext.xml</resource> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/cxf/cxf.extension</resource> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer"> <resource>META-INF/cxf/bus-extensions.xml</resource> </transformer> </transformers> </configuration> </execution> </executions> </plugin> </plugins>

Present in both answers; Present only in the new answer; Present only in the old answer;