Wildfly Maven Plugin not updating config - wildfly

We used to be able to update our Wildfly app server configuration (standalone-full-ha.xml) using wildfly-maven-plugin 1.0.2.Final. It stopped working when we switched to version 1.2.2.Final. We're still on Wildfy 8.2.1. I had to upgrade the plugin because of deployment problems over SSL.
Here's the subproject pom.xml
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<executions>
<execution>
<id>add-${project.artifactId}</id>
<phase>package</phase>
<goals>
<goal>execute-commands</goal>
</goals>
<configuration>
<execute-commands>
<scripts>
<script>${basedir}/processed/scripts/add-${project.artifactId}.cli</script>
</scripts>
</execute-commands>
</configuration>
</execution>
...
I executed:
> mvn package -e -P nonclustered
...
[INFO] --- wildfly-maven-plugin:1.2.2.Final:execute-commands (add-jboss-security) # jboss-security ---
[INFO] ------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------
[INFO] Total time: 6.814 s
[INFO] Finished at: 2018-10-11T14:49:03-04:00
[INFO] Final Memory: 22M/365M
[INFO] ------------------------------------------------------------------
The build succeeds, but the config doesn't update. No errors. I tried searching online to find out which wildfly-maven-plugin versions work with which Wildfly app server version but I can't find any information.

Related

Maven pom.xml for MATLAB compiler project

I have a Tomcat servlet project that requires a MATLAB jar generated by mcc. I have implemented a mojo plugin (mcc-maven-plugin) that generates the jar. It simply takes the specifications from a pom and creates a MATLAB command of the form:
cd '/home/jeffemandel/webpropofolmm/matlab/src/main/matlab';mcc -W 'java:webpropofol_java,loadServlet' -d '/home/jeffemandel/webpropofolmm/matlab/target' class{loadServlet:loadServlet.m} class{locServlet:locServlet.m} class{testStruct:testStruct.m}
This generates the file /home/jeffemandel/webpropofolmm/matlab/target/webpropofol_java.jar
Note that target must exist for mcc to work.
I need this file in my main project, but it is resource-intensive to generate the jar every time I make a minor tweak to the UI (which has a small amount of Java and a lot of HTML, css, and javascript). My confusion point is how to generate a jar that doesn't depend on any Java code. Here is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>org.jeffmandel.webpropofol</groupId>
<artifactId>optimaltiva</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javabuilder</groupId>
<artifactId>javabuilder</artifactId>
<version>9.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<tasks>
<mkdir dir="${project.build.directory}"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jeffmandel</groupId>
<artifactId>mcc-maven-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>mcc</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<packageName>webpropofol_java</packageName>
<className>loadServlet</className>
<classes>
<loadServlet>loadServlet.m</loadServlet>
<locServlet>locServlet.m</locServlet>
<testStruct>testStruct.m</testStruct>
</classes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<groupId>org.jeffmandel.webpropofol</groupId>
<artifactId>optimaltiva</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<file>${project.build.directory}/webpropofol_java.jar</file>
<generatePom>true</generatePom>
</configuration>
<executions>
<execution>
<id>install-jar-lib</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>install</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When I run mvn compile, this is what I get:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< org.jeffmandel.webpropofol:optimaltiva >---------------
[INFO] Building optimaltiva 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # optimaltiva ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jeffemandel/webpropofolmm/matlab/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # optimaltiva ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-antrun-plugin:1.4:run (default) # optimaltiva ---
project.artifactId
[INFO] Executing tasks
[INFO] Executed tasks
[INFO]
[INFO] --- mcc-maven-plugin:0.0.1-SNAPSHOT:mcc (default) # optimaltiva ---
[INFO] cd '/home/jeffemandel/webpropofolmm/matlab/src/main/matlab';mcc -W 'java:webpropofol_java,loadServlet' -d '/home/jeffemandel/webpropofolmm/matlab/target' class{loadServlet:loadServlet.m} class{locServlet:locServlet.m} class{testStruct:testStruct.m}
[INFO] Loading source files for package webpropofol_java...
Constructing Javadoc information...
Standard Doclet version 1.8.0_221
Building tree for all the packages and classes...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/loadServlet.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/loadServletRemote.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/locServlet.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/locServletRemote.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/testStruct.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/testStructRemote.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/Webpropofol_javaMCRFactory.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/package-frame.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/package-summary.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/webpropofol_java/package-tree.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/constant-values.html...
Building index for all the packages and classes...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/overview-tree.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/index-all.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/deprecated-list.html...
Building index for all classes...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/allclasses-frame.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/allclasses-noframe.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/index.html...
Generating /home/jeffemandel/webpropofolmm/matlab/target/doc/html/help-doc.html...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.215 s
[INFO] Finished at: 2020-12-12T22:26:54-05:00
[INFO] -----
The problem is that every time I run mvn compile it generates the jar, rather than seeing that the source files haven't changed so don't regenerate the jar. My ultimate goal is to have one project that contains the matlab and servlet.
I did some more reading and figured out that it was the responsibility of the mojo plugin to figure out whether recompilation was needed. MATLAB needs to rebuild the entire jar even if only a single file changes, so I added the following code to my mojo plugin:
import org.apache.commons.io.filefilter.AgeFileFilter;
import java.io.FileFilter;
File myJar = new File(outputDirectory + File.separator + packageName + ".jar");
AgeFileFilter myFilter = new AgeFileFilter(myJar, false);
File source = new File(sourceDirectory);
File[] files = source.listFiles((FileFilter) myFilter);
if (files.length==0) {
getLog().info("Project up to date");
} else {
...
}
This does the trick.

Creating Windows Executable for OpenJFX 11 Project in Eclipse with Maven Integration

I'm switching over from Java 8 (Oracle JDK) to OpenJDK 11 and OpenJFX 11. I've successfully gotten my project to work in Eclipse through Maven via the clean javafx:run command using the maven-compiler-plugin however I am having issues building a runnable jar and windows executable. I do not need a linux or mac runnable as this project is just an internal product and we only use windows.
I have already tried several plugins such as the maven-shade-plugin and also tried running mvm package to no avail. I've tried this Build executable JAR with JavaFX11 from maven and this How to deploy a JavaFX 11 Desktop application with a JRE.
In the past I could just build a executable jar through Eclipse's "Export Runnable Jar" option and then creating an executable through launch4j, however this does not seem to work anymore and I understand this probably due to the modular structure of OpenJDk 9+.
I have all the JavaFX dependencies added as well as the JAXB ones that I needed and it runs in the IDE when I build it (although I can't get it to run as a Java Application Run Configuration once I made it run in Maven Run Configuration.
Here are my plugins:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>com.tapestry.testertools.ApplicationMainFrame</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.tapestry.testertools.ApplicationMainFrame</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Here is the error message when i attempt to run mvn clean package
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.325 s
[INFO] Finished at: 2019-09-20T09:19:35-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project testertools: Fatal error compiling: invalid flag: --module-path -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Attach source directory with build-helper-maven

I tried to attach a source directory generated by jaxb or cxf in using the build-helper-maven plugin. Unfortunately, even though I got a success in the mvn generate-sources, my eclipse didn't add the target directory as a source folder.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated/cxf</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Log :
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # coucou-services ---
[INFO] Deleting D:\004_Development\coucou\Workspace\coucou-bom\coucou-services\target
[INFO]
[INFO] --- cxf-codegen-plugin:2.4.6:wsdl2java (generate-sources) # coucou-services ---
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-source (add-source) # coucou-services ---
[INFO] Source directory: D:\004_Development\coucou\Workspace\coucou-bom\coucou-services\target\generated\cxf added.
[INFO]
[INFO] -
Do you have any idea ?
Best regards
Eclipse's M2 plugin will interpret better the declarations within the build section. Try this:
<build>
<sourceDirectory>${project.build.directory}/generated/cxf</sourceDirectory>
</build>

Maven build-helper plugin not including sources in multi module project

I am generating webservice artifacts with cxf-xjc and attempting to add them to source with the build-helper plugin. This was working properly when it was used in a single Maven project, but now that I've moved into a multi-module project, the generated classes are not being included as source.
The classes are generated properly and the build-helper plugin is executing after the classes are generated. The output for build-helper shows the correct source directory path where the classes are located and shows 'added'.
pom.xml
<!-- CXF -->
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<id>generate-xsd-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<sourceRoot>${basedir}/target/generated-sources/java</sourceRoot>
<xsdOptions>
<xsdOption>
<!-- <bindingFile>src/main/resources/request.xjb</bindingFile> -->
<xsd>src/main/resources/request.xsd</xsd>
<packagename>${services.package}.package.request</packagename>
</xsdOption>
<xsdOption>
<!-- <bindingFile>src/main/resources/response.xjb</bindingFile> -->
<xsd>src/main/resources/response.xsd</xsd>
<packagename>${services.package}.package.response</packagename>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
<!-- Move generated to source -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Console snip
[INFO] --- **cxf-xjc-plugin:2.3.0:xsdtojava (generate-xsd-sources) # aggregation-jaxrs-api** ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # aggregation-jaxrs-api ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) # aggregation-jaxrs-api ---
[INFO] Compiling 55 source files to C:\workspace\aggregation-parent\aggregation-jaxrs-api\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # aggregation-jaxrs-api ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) # aggregation-jaxrs-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # aggregation-jaxrs-api ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # aggregation-jaxrs-api ---
[INFO] Building jar: C:\workspace\aggregation-parent\aggregation-jaxrs-api\target\aggregation-jaxrs-api-1.0-SNAPSHOT.jar
[INFO]
**[INFO] --- build-helper-maven-plugin:1.12:add-source (add-source) # aggregation-jaxrs-api ---
[INFO] Source directory: C:\workspace\aggregation-parent\aggregation-jaxrs-api\target\generated-sources\java added.**
This configuration worked fine prior to me moving it to a module. I've changed to build-helper phase between generate-sources and process-sources phase with no luck. I am using Spring Tool Suite 3.8 which is based on Eclipse Neon 4.6.1.
Thanks
I solved the issue by moving the project folders into my Eclipse workspace. They were situated outside the workspace and for some reason moving the project into the workspace and reimporting it has fixed things.

Maven is not finding scala tests

I have a scala test class but when I attempt to run using the Maven goal 'test'
the tests are not being run. I receive the Maven message "There are no tests to run." even though the tests are located in the scala test class. Do I need to add extra configuration ?
Here is my package setup :
Here is the output of the Maven "test" goal when run against the pom file :
[INFO] Scanning for projects... [INFO]
[INFO]
------------------------------------------------------------------------ [INFO] Building scala.maven.test 0.0.1-SNAPSHOT [INFO]
------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.4.3:resources
(default-resources) # scala.maven.test --- [WARNING] Using platform
encoding (Cp1252 actually) to copy filtered resources, i.e. build is
platform dependent! [INFO] Copying 0 resource [INFO] [INFO] ---
maven-scala-plugin:2.9.1:add-source (scala-compile-first) #
scala.maven.test --- [INFO] Add Source directory:
C:\workspaces\29112012\scala.maven.test\src\main\scala [INFO] Add Test
Source directory:
C:\workspaces\29112012\scala.maven.test\src\test\scala [INFO] [INFO]
--- maven-scala-plugin:2.9.1:compile (scala-compile-first) # scala.maven.test --- [ERROR]
C:\workspaces\29112012\scala.maven.test\src\main\java [ERROR]
C:\workspaces\29112012\scala.maven.test\src\main\scala [ERROR]
C:\workspaces\29112012\scala.maven.test\src\test\scala [INFO]
Compiling 2 source files to
C:\workspaces\29112012\scala.maven.test\target\classes [INFO] [INFO]
--- maven-compiler-plugin:2.0.2:compile (default-compile) # scala.maven.test --- [INFO] Nothing to compile - all classes are up to
date [INFO] [INFO] --- maven-compiler-plugin:2.0.2:compile (default)
# scala.maven.test --- [INFO] Nothing to compile - all classes are up
to date [INFO] [INFO] --- maven-resources-plugin:2.4.3:testResources
(default-testResources) # scala.maven.test --- [WARNING] Using
platform encoding (Cp1252 actually) to copy filtered resources, i.e.
build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO]
--- maven-scala-plugin:2.9.1:testCompile (scala-test-compile) # scala.maven.test --- [ERROR]
C:\workspaces\29112012\scala.maven.test\src\test\java [ERROR]
C:\workspaces\29112012\scala.maven.test\src\test\java..\scala [INFO]
Compiling 1 source files to
C:\workspaces\29112012\scala.maven.test\target\test-classes [INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile
(default-testCompile) # scala.maven.test --- [INFO] Nothing to compile
- all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.7.1:test (default-test) # scala.maven.test ---
[INFO] Surefire report directory:
C:\workspaces\29112012\scala.maven.test\target\surefire-reports
------------------------------------------------------- T E S T S
------------------------------------------------------- There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO]
------------------------------------------------------------------------ [INFO] Total time: 11.354s [INFO] Finished at: Fri Nov 30 16:57:05 GMT
2012 [INFO] Final Memory: 7M/17M [INFO]
Here is my pom.xml :
<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>
<groupId>scala.maven.test</groupId>
<artifactId>scala.maven.test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.9.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.scala-tools
</groupId>
<artifactId>
maven-scala-plugin
</artifactId>
<versionRange>
[2.9.1,)
</versionRange>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.0-1</artifactId>
<version>2.0.M5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
Even though this is a very late reply, but I wrote it hoping that someone might get benefitted from it in case their scala unit test are not getting discovered. One of the major and silent culprit is the absolute path to the test classes. If there is a space in the name of any directory on the path, scalatest won't pick it up. Rename such directories for successful running of unit tests.
What's your test class name? Maven can be pretty picky and by default I think it requires the class name to end in 'Test'.
See my previos post:
Maven won't run tests