I am trying to integrate SpringBootApplication(microservice) with StackdriverLogging by using spring-cloud-gcp-starter-logging. I am able to see the logs in GCP but in the logs traceId and SpanId is missing.For this I tried to use Spring-cloud-sleuth also, but as I am using apache kafka in my microservice sleuth is not working properly.
Can anyone help me how Can I add traceId and SpanId information in logs??
POM.xml Configuration :
<spring-cloud.version>Hoxton.SR1</spring-cloud.version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-logging</artifactId>
</dependency>
logback.xml :
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/cloud/gcp/autoconfigure/logging/logback-json-appender.xml" />
<appender name="CONSOLE_JSON" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.springframework.cloud.gcp.logging.StackdriverJsonLayout">
<includeTraceId>true</includeTraceId>
<includeSpanId>true</includeSpanId>
<includeThreadName>false</includeThreadName>
</layout>
</encoder>
</appender>
<logger name="org.apache.kafka" level="warn">
<appender-ref ref="CONSOLE_JSON" />
</logger>
<root level="INFO">
<appender-ref ref="CONSOLE_JSON" />
</root>
</configuration>
By default, Sleuth doesn’t send the trace data for every single request. You probably don’t want to trace every single request either. The trace sampling rate can be adjusted by configuring the spring.sleuth.sampler.percentage property. For more details please refer to "Spring Boot and Spring Cloud Sleuth" in this link and have a look to this video.
Related
Due to a recent EKS update on AWS I was not anymore able to run spark jobs on AWS (kubernetes client version had to be upgraded).
Therefore, I have been building the last Spark snapshot version (2.4.5-SNAPSHOT, it contains the bugfix I need) successfully.
Now I want to add it to my project, replacing the old 2.3.3 version.
Unfortunately I get some compilation error (see below).
I am probably doing something wrong with my pom.xml file. The final goal is to fetch jar files from remote and from local (the repo)
Ideas?
Thanks!
P.s.
Ubuntu 18.04 + intellij
The relevant part of the pom.xml file are the following:
<?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>
I add my local repo...
<!-- My local repo where the jar file has been placed -->
<repositories>
<repository>
<id>Local</id>
<name>Repository Spark</name>
<url>/home/cristian/repository/sparkyspark/spark</url>
</repository>
</repositories>
<groupId>sparkjob</groupId>
<artifactId>sparkjob</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.test.skip>true</maven.test.skip>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>entry.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<rules><dependencyConvergence/></rules>
</configuration>
</plugin>
</plugins>
</build>
...
<dependencies>
....
....
here it is, the jar file I need
<!-- The last Spark jar file -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
...
....
</dependencies>
This is the error message, the path is correct...the file is there.
Ideas? :)
ERROR:
Could not resolve dependencies for project sparkjob:sparkjob:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.apache.spark:spark-core_2.11:jar:2.4.5-SNAPSHOT: Failed to read artifact descriptor for org.apache.spark:spark-core_2.11:jar:2.4.5-SNAPSHOT: Could not transfer artifact org.apache.spark:spark-core_2.11:pom:2.4.5-SNAPSHOT from/to Local (/home/cristian/repository/sparkyspark/spark): Cannot access /home/cristian/repository/sparkyspark/spark with type default using the available connector factories.....
UPDATE: hard wiring the path seems to be a good work-around...
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.5-SNAPSHOT</version>
<scope>system</scope>
<systemPath>/home/cristian/repository/sparkyspark/spark/spark-core_2.11-2.4.5-SNAPSHOT.jar</systemPath>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
If you want to use a folder as a repository you have to use file:// protocol.
So you repository config should be.
<repositories>
<repository>
<id>Local</id>
<name>Repository Spark</name>
<url>file:///home/cristian/repository/sparkyspark/spark</url>
</repository>
</repositories>
I've created a new WSO2 Api Manager Mediator, which'll responsible for filtering Signed SOAP Envelopes. In the request, I receive a tag, which I want to parse with XMLSignatureFactory.
Digital Signature API:
https://www.oracle.com/technetwork/articles/javase/dig-signature-api-140772.html
Input:
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
Id="SIG-1F873A0D2A87BCE8721558280884557279">
<ds:SignedInfo>
...
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"/>
<ds:Reference URI="#id-349F63E22F25E7CF2915581003601374">
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"/>
<ds:DigestValue>..Base64 encoded value...</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>..Base64 encoded value...</ds:SignatureValue>
<ds:KeyInfo Id="KI-1F873A0D2A87BCE8721558280884517277">
...
</ds:KeyInfo>
</ds:Signature>
Source code:
XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
// Find Signature element.
NodeList nl = doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
if (nl.getLength() == 0) {
throw new Exception("Cannot find Signature element");
}
// Create a DOMValidateContext and specify a KeySelector
// and document context.
DOMValidateContext valContext = new DOMValidateContext(cert.getPublicKey(), nl.item(0));
// Unmarshal the XMLSignature.
XMLSignature signature = fac.unmarshalXMLSignature(valContext);
// Validate the XMLSignature.
boolean coreValidity = signature.validate(valContext);
// Check core validation status.
if (coreValidity == false) {
System.err.println("Signature failed core validation");
}
In a standard Java SE program it works fine, but when I use it in a Mediator, I've got the following error:
Exception occured! java.lang.ClassCastException: org.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory cannot be cast to javax.xml.crypto.dsig.XMLSignatureFactory
at javax.xml.crypto.dsig.XMLSignatureFactory.findInstance(XMLSignatureFactory.java:202)
at javax.xml.crypto.dsig.XMLSignatureFactory.getInstance(XMLSignatureFactory.java:250)
Maven config:
...
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<bouncycastle.version>1.61</bouncycastle.version>
...
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>2.1.7-wso2v80</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom.wso2</groupId>
<artifactId>axiom</artifactId>
<version>1.2.11.wso2v11</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
...
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<!-- <Export-Package>mediator</Export-Package> -->
<!--<DynamicImport-Package>*</DynamicImport-Package>-->
<Import-Package>
!javax.xml.crypto.*; version="???",
org.apache.xml.security;version="0.0.0",
*
</Import-Package>
</instructions>
</configuration>
</plugin>
I guess this is happening due to package javax.xml.crypto.; version="xxx" exported with wso2 wss4j bundle is conflicting with the default javax.xml.crypto. package exported by the JDK.
In order to overcome this issue, you may pack the mediator as bundle ( OSGI bundle and place it in dropins folder ) and restrict that specific import in the mediator as follows.
Please start the AM in osgiConsole ( with flag -DosgiConsole ) and check the version of the javax.xml.crypto.* package which is being exported by wss4j. Then exclude that specific version from the import section of the mediator.
A sample code is as follows.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Import-Package>
!javax.xml.crypto.*; version="xxx",
org.apache.xml.security;version="0.0.0",
*
</Import-Package>
</instructions>
</configuration>
</plugin>
Thanks
I have used Jersey Restful API to create a web service and I have the below:
#POST
#Path("/process/")
#Consumes({MediaType.MULTIPART_FORM_DATA})
#Produces({MediaType.APPLICATION_JSON})
public Response process(#FormDataParam("upload") InputStream is, #FormDataParam("upload") FormDataContentDisposition formData);
I have used the following dependencies:
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1-m01</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.jersey.contribs/jersey-multipart -->
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-server -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.ws.rs/jsr311-api -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
Configuration in Web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/ws-context.xml</param-value>
</context-param>
in ws-context.xml, I have this part:
<bean id="restManagerService" class="com.rs.service.impl.RestManagerServiceImpl">
<property name="restRequestService" ref="restRequestService" />
</bean>
<bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="100000" />
</bean>
<jaxrs:server id="userManagerREST" address="/rest/v1">
<jaxrs:serviceBeans>
<ref bean="restManagerService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean='jsonProvider' />
<ref bean='multipartResolver' />
<bean class="com.rs.exception.ExceptionHandler" />
</jaxrs:providers>
</jaxrs:server>
Now to test this, I am using Postman app to send a Post request. Below is the content from the code window:
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryxxxxxxxxx
------WebKitFormBoundaryxxxxxxxxx
Content-Disposition: form-data; name="upload"; filename="test.json"
I have already referred to several samples on google, like this , this, and this and I see that I have provided the parameters correctly but I still get 415 Unsupported Media Type error in Postman. I have several other web services in this project which consumes MediaType application/json so the project configuration shouldn't be an issue.
Can somebody please shed some light as to what is wrong here.
UPDATE: Added additional details related to all jersey and WS related dependencies used and important content from the web.xml file
It could be a problem in Postman, not your code. I had this problem as well.
Try removing Content-type header, and make sure you select form-data in the body tab:
I am developing RESTFul services in my application. We are using 'cxf-codegen-plugin' to generate the JAXB classes from the schema. For a given requirement, I need to add some annotation to the generated JAXB classes and I was trying to use Annotate Plugin(Annox) for this but having issue in using it. I am getting org.xml.sax.SAXParseException: Using "http://annox.dev.java.net" customizations requires the "-Xannotate" switch to enable this plug-in.
This is how I have the setup in my codebase:
1. The WSDL refer to a XSD where I have the definitions of annotations.
2. pom.xml is using 'cxf-codegen-plugin' to generate the jabx classes.
3. The RESTFul service need some additional annotation on the generated classes, so I am trying ti use Annox to get the work done.
This is the snippet from the XSD:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="gov.nih.nci.po.webservices.types"
xmlns:tns="gov.nih.nci.po.webservices.types" elementFormDefault="qualified"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1"
xmlns:annox="http://annox.dev.java.net"
xmlns:ja="http://annox.dev.java.net/org.codehaus.jackson.annotate"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"
jaxb:extensionBindingPrefixes="xjc annox">
<complexType name="PersonRole" abstract="true">
<annotation>
<appinfo>
<annox:annotate>
<ja:JsonTypeInfo use="CLASS" include="PROPERTY" property="#class"/>
</annox:annotate>
</appinfo>
</annotation>
<complexContent>
<extension base="tns:Role">
<sequence>
<element name="personId" type="long" />
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
and this is how I want my generated class to look like:
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "PersonRole", propOrder = { "personId" })
#XmlSeeAlso({ HealthCareProvider.class, OrganizationalContact.class,
ClinicalResearchStaff.class })
#JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "#class")
public abstract class PersonRole extends Role {
And below is the entry from pom.xml:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/PersonService.wsdl</wsdl>
<extraargs>
<extraarg>-xjc-Xannotate</extraarg> </extraargs>
</wsdlOption>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
Also I noticed that if I give some wrong value/configuration in xsd under JsonTypeInfo section, the build fail & complains (like mandatory field 'use' is missing etc) -- so I am assuming that the Annox plug-in is enabled & trying to do something. but then when I use above configurations, the build is failing with SAXParseException: Using "http://annox.dev.java.net" customizations requires the "-Xannotate" switch to enable this plug-in.
Could anybody please suggest as how this can be fixed?
We are in the process of upgrading from Weblogic 10g to 12c. A portion of our code base is webservices so we were using weblogic-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>2.9.5</version>
<configuration>
<contextPath>ws</contextPath>
<keepGenerated>true</keepGenerated>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jwsc</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>weblogic</artifactId>
<version>${weblogic.version}</version>
<scope>system</scope>
<systemPath>${bea.lib}/weblogic.jar</systemPath>
</dependency>
</dependencies>
</plugin>
The build error I see is
[ERROR] Failed to execute goal org.codehaus.mojo:weblogic-maven-plugin:2.9.5:jwsc (default) on project webService: Execution default of goal org.codehaus.mojo:weblogic-maven-plugin:2.9.5:jwsc failed: Plugin org.codehaus.mojo:weblogic-maven-plugin:2.9.5 or one of its dependencies could not be resolved: Failure to find weblogic:webservices:jar:10.3.6 in http://ccicusbuild1/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
Deeper inspection shows that the plugin has a dependency on weblogic:weblogic:10.3.6 and weblogic:webservices:10.3.6. As shown in the previous code, I can override weblogic:weblogic:10.3.6 with weblogic:weblogic:12.1.1. The problem is webservices.jar is no longer apart of weblogic 12c, so I have nothing to override the dependency with, nor can I exclude it.
The page for weblogic-maven-plugin (http://mojo.codehaus.org/weblogic-maven-plugin/) mentions support for 12c, but doesn't give any details.
The goal is to be able to run JWSC through maven. Is there a tweak to the plugin configuration that I can do to make it work, or is there another plugin, or do I need to bite the bullet and run the code with the ant plugin?
This was the eventual solution we used. If some one else has something better, please post it.
plugins portion of pom.xml
<plugins>
<!--
Below contains a work around to build web services for Weblogic 12c.
weblogic-maven-plugin was how things were done (and was much cleaner)
but at the time of this work around, it doesn't appear to support Weblogic 12c.
If in the future, weblogic-maven-plugin or some other plugin become known,
it should replace both parts of the work around.
-->
<!-- START OF WORK AROUND part 1-->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>set-main-artifact</id>
<phase>package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
project.artifact.setFile(new File(project.build.directory+'/'+project.artifactId+'-'+project.version+'.war'))
</source>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>prepare-package</phase>
<configuration>
<target>
<property name="maven.compile.classpath" refid="maven.compile.classpath" />
<property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
<property name="maven.test.classpath" refid="maven.test.classpath" />
<property name="maven.plugin.classpath" refid="maven.plugin.classpath" />
<ant antfile="src/main/ant/build.xml" target="all" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>weblogic</artifactId>
<version>${weblogic.version}</version>
<scope>system</scope>
<systemPath>${bea.lib}/weblogic.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</plugin>
<!-- END OF WORK AROUND part 1 -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<!-- START OF WORK AROUND part 2 -->
<executions>
<execution>
<id>default-war</id>
<phase>none</phase>
</execution>
</executions>
<!-- END OF WORK AROUND part 2 -->
</plugin>
</plugins>
build.xml
<project name="build-webservice" default="all">
<target name="all" depends="build.webService" />
<path id="maven_plugin_classpath">
<pathelement path="${maven.plugin.classpath}" />
</path>
<path id="maven_runtime_classpath">
<pathelement path="${maven.compile.classpath}" />
<pathelement path="${maven.runtime.classpath}" />
<pathelement path="${maven.plugin.classpath}" />
<pathelement path="${weblogic.jar}" />
</path>
<taskdef name="jwsc"
classname="weblogic.wsee.tools.anttasks.JwscTask"
classpath="${weblogic.jar}"
classpathref="maven_plugin_classpath"
/>
<target name="build.webService" description="Compile the web services if not up2date">
<!--
Eclipse compiles and places classes into target/classes when the workspace is building.
If this folder exists when jwsc runs, then any classes that are already compiled will NOT
be included in the final WAR file. Thus, this directory is removed prior to created the
webServices WAR fie.
-->
<delete dir="target/classes" />
<jwsc srcdir="${project.build.sourceDirectory}"
destDir="target"
classpathref="maven_runtime_classpath"
keepGenerated="yes"
applicationxml="${project.build.directory}/application.xml"
fork="true"
memorymaximumsize="256m"
verbose="true"
debug="on"
>
<module contextPath="ws" name="${project.artifactId}-${project.version}">
<jwsfileset srcdir=".">
<include name="**/*.java" />
<exclude name="**/*Test.java" />
</jwsfileset>
</module>
</jwsc>
</target>
</project>
Overall description:
War plugin execution is overwritten so that it isn't run
The compiling and packaging is handled in ant by JwscTask
gmaven plugin is used inform maven that it should use the ant generated war as the artifact
Notes:
Alternatives for gmaven were attachartifact ant task and build-helper-maven-plugin as specified in How to register a custom built jar file as maven main artifact?, but neither worked. Both resulted in An attached artifact must have a different ID than its corresponding main artifact.