CopyPastor

Detecting plagiarism made easy.

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

Possible Plagiarism

Plagiarized on 2019-09-11
by James R. Perkins

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;

The reload doesn't work so well with the plugin. However you can use offline CLI which will start an embedded server and execute the commends. You'll need to set the `jboss-home` property to use the embedded server.
Here's an example:
<!-- language: lang-xml -->
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack</id> <phase>validate</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.wildfly</groupId> <artifactId>wildfly-dist</artifactId> <version>15.0.1.Final</version> <type>zip</type> <overWrite>false</overWrite> <outputDirectory>target</outputDirectory> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> <version>2.0.1.Final</version> <configuration> <offline>true</offline> <jboss-home>target/wildfly-15.0.1.Final</jboss-home> </configuration> <executions> <execution> <id>Configure1</id> <phase>install</phase> <goals> <goal>execute-commands</goal> </goals> <configuration> <commands> <command>embed-server</command> <command>module add --name=org.postgresql --dependencies=javax.api,javax.transaction.api --resources=${project.build.directory}${file.separator}postgresql-${version.postgres.jdbc}.jar</command> <command>/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgresql", driver-class-name="org.postgresql.Driver")</command> <command>data-source add --name=xpDS --driver-name=postgres --connection-url=jdbc:postgresql://localhost:5432/xp_test --jndi-name=java:jboss/datasources/xpDS --use-java-context=true --user-name=postgres --password=postgres --max-pool-size=25 --blocking-timeout-wait-millis=5000 --idle-timeout-minutes=5 --enabled=true</command> <command>stop-embedded-server</command> </commands> </configuration> </execution> <execution> <id>Configure2</id> <phase>install</phase> <goals> <goal>execute-commands</goal> </goals> <configuration> <batch>false</batch> <scripts> <script>src/templates/xd1.cli</script> </scripts> </configuration> </execution> </executions> </plugin>

You'd need to add the `embed-server` and `stop-embedded-server` in your CLI script too.
Use the maven-shade-plugin to package all dependencies into one uber-jar. It can also be used to build an executable jar 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 content of specific files instead of overwriting them. This is needed when there are resource files that are have the same name across the jars and the plugin tries to package all the resource files
See example below
<plugins> <!-- This plugin provides the capability to package the artifact in an uber-jar, 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 jars--> <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>properties.properties</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;