Tika, Maven, dependencies... Why is Tika using EmptyParser? - java

I want to use Tika as a dependency in a Maven project, to extract metadatas from files. It's working fine when I run the class with mvn exec:java, but not with java -cp, so I suspect it is a dependency problem...
I included all the dependencies in the jar with the maven shade plugin, and at build they are included.
The 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.company.myapp</groupId>
<artifactId>metadata-extractor</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Metadata Extractor</name>
<url>http://maven.apache.org</url>
<properties>
<tika.version>1.19</tika.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- Tika -->
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>${tika.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<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>
</plugins>
</build>
</project>
Main class:
public class App
{
public static void main( String[] args )
{
// Get path
Path path = Paths.get("/path/to/image.jpg");
// Use Tika
TikaConfig tikaConfig = TikaConfig.getDefaultConfig();
Metadata metadata = new Metadata();
AutoDetectParser parser = new AutoDetectParser(tikaConfig);
ContentHandler handler = new BodyContentHandler(-1);
try {
TikaInputStream stream = TikaInputStream.get(path, metadata);
parser.parse(stream, handler, metadata, new ParseContext());
} catch (IOException | SAXException | TikaException e) {
System.out.println("error: " + e.toString());
return;
}
// Prints the metadata and content...
System.out.println("Parsed Metadata: ");
System.out.println(metadata);
System.out.println("Parsed Text: ");
System.out.println(handler.toString());
}
}
Result, with mvn exec:java (working as expected):
Parsed Metadata:
... X-Parsed-By=org.apache.tika.parser.DefaultParser X-Parsed-By=org.apache.tika.parser.jpeg.JpegParser ... other metadatas ...
Parsed Text:
But, with:
mvn clean package
java -cp target/metadata-extractor-1.0-SNAPSHOT.jar org.company.myapp.App
I got:
Parsed Metadata:
X-Parsed-By=org.apache.tika.parser.EmptyParser resourceName=image.jpg Content-Length=1557172 Content-Type=image/jpeg
Parsed Text:
What am I doing wrong? How do I have to build the project for it to correctly autodetect the parser?
Thanks.

There is no parser in your classpath so EmptyParser is chosen. I think the problem is in shade plugin. Remove this line:
<minimizeJar>true</minimizeJar>
And add these dependencies with proper version:
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>jbig2-imageio</artifactId>
</dependency>
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-core</artifactId>
</dependency>
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-jpeg2000</artifactId>
</dependency>

Related

TeaVM and WebAssembly - build errors

I want to use Java code in the web. For this I want to convert Java to WASM and use this wasm-file in JavaScript. For converting Java to WebAssembly, I am using TeaVM.
First, I created an archetype with this command: mvn archetype:generate -DarchetypeGroupId=org.teavm.flavour -DarchetypeArtifactId=teavm-flavour-application -DarchetypeVersion=0.2.0
In addition, I added these two dependencies (according to http://blog.dmitryalexandrov.net/webassembly-for-java-developers/):
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-jso-apis</artifactId>
<version>${teavm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-interop</artifactId>
<version>${teavm.version}</version>
</dependency>
and added the following in the plugin section:
<targetType>WEBASSEMBLY</targetType>
<optimizationLevel>FULL</optimizationLevel>
<heapSize>8</heapSize>
My Java file:
#BindTemplate("templates/client.html")
public class Client extends ApplicationTemplate {
private String userName = "ABC";
public static void main(String[] args) {
Client client = new Client();
client.bind("application-content");
}
#Export(name = "getUserName")
public String getUserName() {
return userName;
}
}
But when I am doing mvn clean package, I am getting to following error (but a wasm file is created):
my complete pom:
<?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>my.company</groupId>
<artifactId>java_wasm</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<flavour.version>0.2.0</flavour.version>
<teavm.version>0.6.0</teavm.version>
<jackson.version>2.5.4</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-classlib</artifactId>
<version>${teavm.version}</version>
</dependency>
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-metaprogramming-impl</artifactId>
<version>${teavm.version}</version>
</dependency>
<dependency>
<groupId>org.teavm.flavour</groupId>
<artifactId>teavm-flavour-widgets</artifactId>
<version>${flavour.version}</version>
</dependency>
<dependency>
<groupId>org.teavm.flavour</groupId>
<artifactId>teavm-flavour-rest</artifactId>
<version>${flavour.version}</version>
</dependency>
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-jso-apis</artifactId>
<version>${teavm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-interop</artifactId>
<version>${teavm.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<webResources>
<resource>
<directory>${project.build.directory}/generated/js</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.teavm</groupId>
<artifactId>teavm-maven-plugin</artifactId>
<version>${teavm.version}</version>
<executions>
<execution>
<id>web-client</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<targetDirectory>${project.build.directory}/generated/js/teavm</targetDirectory>
<mainClass>my.company.Client</mainClass>
<minifying>true</minifying>
<debugInformationGenerated>true</debugInformationGenerated>
<sourceMapsGenerated>true</sourceMapsGenerated>
<sourceFilesCopied>true</sourceFilesCopied>
<optimizationLevel>ADVANCED</optimizationLevel>
<targetType>WEBASSEMBLY</targetType>
<optimizationLevel>FULL</optimizationLevel>
<heapSize>8</heapSize>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
How can I create a complete WASM without errors? Thank you in advance!
Wasm backend of TeaVM does not support JSO interop layer. It also supports subset of features available in JavaScript backend. So there's no way to make TeaVM Flavour work in Wasm, instead your should prefer JavaScript target. If you want to learn how to deal with Wasm BE, you can take a look at example.
Wasm has proven to be extremely inappropriate to run Java, so I recommend to use JavaScript BE of TeaVM. Also, please note that official site (htts://teavm.org) lists links where you can get help (google groups, gitter, direct email). I don't follow StackOverflow questions about TeaVM and don't receive notifications from SO.

Maven build does not generate code with grpc-java

I am trying to generate code for a gRPC application, with Java, Maven and Intellij.
I followed the documentation of grpc-java https://github.com/grpc/grpc-java/blob/master/README.md, but when I build the project, no code is generated.
Here is my pom.xml file:
<?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.nolapps</groupId>
<artifactId>grpc-simpleapp</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.35.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.35.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.35.0</version>
</dependency>
<dependency> <!-- necessary for Java 9+ -->
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
<version>6.0.53</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.12.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.35.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And My proto file is in src/main/proto (messages.proto)
syntax = "proto3";
option java_package="grpc.messages";
message Employee {
int32 id = 1;
int32 badgeNumber = 2;
string firstName = 3;
string lastName = 4;
float vacationAccrualRate = 5;
float vacationAccrued = 6;
}
message GetAllRequest {}
message GetByBadgeNumberRequest {
int32 badgeNumber = 1;
}
message EmployeeRequest {
Employee employee = 1;
}
message EmployeeResponse {
Employee employee = 1;
}
message AddPhotoRequest {
bytes data = 1;
}
message AddPhotoResponse {
bool isOk = 1;
}
service EmployeeService {
rpc GetByBadgeNumber (GetByBadgeNumberRequest) returns (EmployeeResponse);
rpc GetAll (GetAllRequest) returns (stream EmployeeResponse);
rpc Save (EmployeeRequest) returns (EmployeeResponse);
rpc SaveAll (EmployeeRequest) returns (stream EmployeeResponse);
rpc AddPhoto (AddPhotoRequest) returns (AddPhotoResponse);
}
To build the project, (from Intelij), I go to:
Build -> Build Project. But nothing happens.
My question: Any idea why my code is not generated?
Usually Maven will generate the code and put it under target/generated-source/protubf
In order to build the code you need to issue the following command:
$ mvn clean install
In IntelliJ you need to edit configuration of run ( RUN -> Edit Configuration )
You can also define the output directory of protobuf plugin in maven by adding the following configurations to the plugin
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.21.7:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.51.0:exe:${os.detected.classifier}</pluginArtifact>
<outputBaseDirectory>src/main/java/</outputBaseDirectory>
<outputDirectory>src/main/java/</outputDirectory>
<clearOutputDirectory>false</clearOutputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
This will output the generated files under java directory and creating the package defined in your proto file ( grpc.messages in your example)
Adding the below snippet to under build also works.
Make sure you have the correct path mentioned pointing to the .protoFiles.
<protoSourceRoot>
${basedir}/src/main/resources/proto/
</protoSourceRoot>

How to avoid a DestinationAccessException when sending a POST request to an OData service using SAP Cloud SDK version 3.2.0

I'm developing a Java application that uses SAP Cloud SDK version 3.2.0. I've an endpoint that handles a request asynchronously using queueCallable of ResilienceDecorator; through this service, Business Partners (BP) are created. I'm doing stress tests using SoapUI, sometimes when sending multiple requests, for example, 50 requests, a DestinationAccessException is generated. I don't know what is the cause of this problem, could someone help me find a solution?
Sometimes the following message is displayed:
DestinationAccessException:
com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException:
javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.naming.java.javaURLContextFactory [Root exception is
java.lang.ClassNotFoundException:
org.apache.naming.java.javaURLContextFactory]
Other times the following message is displayed:
DestinationAccessException: No destination for name
'ErpQueryEndpoint' could be found in any of the registered loaders.
This is my class AccountController:
public class AccountController {
#Autowired
AccountBF accountBF;
...
#RequestMapping(value = "/bp/create/extended", method = RequestMethod.POST)
#ResponseBody
public ResponseEntity<?> createBpExtended(#RequestBody BpCreateBasicRequest bpCreateRequest) throws IOException {
Object bpCreateBasicResponse = accountBF.bpCreateExtended(bpCreateRequest);
return ResponseEntity.ok(bpCreateBasicResponse);
}
}
This is my class AccountBFimpl:
public class AccountBFimpl implements AccountBF {
private ResilienceConfiguration conf;
...
public Object executeAsyncCall(BpCreateBasicRequest bpCreateRequest) {
LogMessage logMessage = new LogMessage();
...
JSONObject jsonResponse = null;
try {
ODataCreateRequestImpl createRequest = new ODataCreateRequestImpl("/sap/opu/odata/sap/ZAS_BP_CREATION_SRV",
"BP_DATASet", bodyAsMap, null, null, null, headersAsMap, null, false, null, null, false);
createRequest.execute("ErpQueryEndpoint");
jsonResponse = new JSONObject();
} catch (DestinationAccessException e ) {
System.out.println("DestinationAccessException: "+e.getMessage());
logMessage.setMessageContent("Creating the BP: " + bpCreateRequest.getNumeroId() + ". " +
" DestinationAccessException: "+e.getMessage());
writeMessageContent(logMessage);
} catch (HttpServerErrorException e ) {
System.out.println("HttpServerErrorException: " + e.getMessage());
logMessage.setMessageContent("Creating the BP: " + bpCreateRequest.getNumeroId() + ". " +
" HttpServerErrorException: "+e.getMessage());
writeMessageContent(logMessage);
} catch (Exception e ) {
System.out.println("Exception: " + e.getMessage());
logMessage.setMessageContent("Creating the BP: " + bpCreateRequest.getNumeroId() + ". " +
" Exception: "+e.getMessage());
writeMessageContent(logMessage);
}
...
return jsonResponse;
}
public Object bpCreateExtended(BpCreateBasicRequest bpCreateRequest) throws IOException {
LogMessage logMessage = new LogMessage();
logMessage.setMessageContent("Creating the BP: " + bpCreateRequest.getNumeroId() + ". " + "Entering the" +
" bpCreateExtended method");
writeMessageContent(logMessage);
this.conf = ResilienceConfiguration.of(AccountBFimpl.class);
Object response = null;
CompletableFuture<Object> futureFirstStep = ResilienceDecorator.queueCallable(() ->
executeAsyncCall(bpCreateRequest), conf);
try {
TimeUnit.SECONDS.sleep(5);
} catch (InterruptedException e) {
logMessage.setMessageContent("Creating the BP: " + bpCreateRequest.getNumeroId() + ". " +
" InterruptedException in sleep - bpCreateExtended: "+e.getMessage());
writeMessageContent(logMessage);
}
logMessage.setMessageContent("After create the BP: " + bpCreateRequest.getNumeroId() + ". " + "Leaving the" +
" bpCreateExtended method");
writeMessageContent(logMessage);
return (JSONObject) response;
}
}
This is the content of 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.atlantida.services</groupId>
<artifactId>account</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>atlantida</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.sap.cloud.sdk</groupId>
<artifactId>sdk-bom</artifactId>
<version>3.2.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<java-version>1.8</java-version>
<springframework.version>5.1.8.RELEASE</springframework.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.11</junit.version>
<jackson-version>2.9.2</jackson-version>
<lombok.version>1.18.8</lombok.version>
<jcl.slf4j.version>1.7.12</jcl.slf4j.version>
<logback.version>1.1.3</logback.version>
<!-- if you are behind a proxy use the following two properties to configure your proxy. Default: None -->
<proxy.host />
<proxy.port />
<non.proxy.hosts />
<!-- Properties that are related to the SAP Cloud Platform. -->
<scp.sdkVersion>1.44.12</scp.sdkVersion>
<!-- this is the location of your local SAP CP Neo runtime -->
<scp.sdkInstallPath>${project.basedir}/scp/sdk-${scp.sdkVersion}</scp.sdkInstallPath>
<scp.sdkLocalServerContentPath>${project.basedir}/localServerContent</scp.sdkLocalServerContentPath>
<scp.sdkErpEndpoint>${scp.sdkInstallPath}/server/config_master/service.destinations/destinations/ErpQueryEndpoint</scp.sdkErpEndpoint>
<scp.sdkSymbolicLink>${project.basedir}/scp/sdk</scp.sdkSymbolicLink>
<scp.sdkNeoCmdExtension>.sh</scp.sdkNeoCmdExtension>
<scp.sdkNeoCmd>${scp.sdkInstallPath}/tools/neo${scp.sdkNeoCmdExtension}</scp.sdkNeoCmd>
<scp.sdkLocalServer>${scp.sdkInstallPath}/server</scp.sdkLocalServer>
<scp.skipInstallSdk>false</scp.skipInstallSdk>
<scp.skipDeploy>false</scp.skipDeploy>
<scp.skipPutDestination>false</scp.skipPutDestination>
<scp.skipRestart>false</scp.skipRestart>
<scp.skipRollingUpdate>true</scp.skipRollingUpdate>
<scp.vmArguments />
<scp.vmSize>lite</scp.vmSize>
<scp.vmMinProcesses>1</scp.vmMinProcesses>
<scp.vmMaxProcesses>1</scp.vmMaxProcesses>
<scp.app />
<scp.host />
<scp.account />
<scp.username />
<scp.password />
<!-- Required for SAP CP user session management and audit logging. -->
<scp.warImportPackage>com.sap.security.auth.service,com.sap.security.um.service.api,com.sap.core.service.auditlog.impl,com.sap.cloud.auditlog,com.sap.cloud.auditlog.exception,com.sap.cloud.auditlog.extension</scp.warImportPackage>
<!-- Defines whether the deployment is productive or not. -->
<productive />
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Bridge logging from JCL to SLF4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${jcl.slf4j.version}</version>
</dependency>
<!-- logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<dependency>
<groupId>com.sap.cloud.sdk.cloudplatform</groupId>
<artifactId>scp-neo</artifactId>
</dependency>
<dependency>
<groupId>com.sap.cloud.servicesdk</groupId>
<artifactId>odatav2-connectivity-sdk3</artifactId>
<version>1.36.2</version>
</dependency>
<dependency>
<groupId>com.sap.cloud.sdk.cloudplatform</groupId>
<artifactId>security-servlet</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sap.cloud</groupId>
<artifactId>neo-javaee7-wp-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>atlantida</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>SAP Cloud SDK Project Structure Checks</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.5</version>
</requireMavenVersion>
<requireJavaVersion>
<version>${java.version}</version>
</requireJavaVersion>
<reactorModuleConvergence />
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<attachClasses>true</attachClasses>
<archive>
<manifestEntries>
<Version>${project.version}</Version>
<Import-Package>${scp.warImportPackage}</Import-Package>
</manifestEntries>
</archive>
<webResources>
<resources>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**/web.xml</include>
</includes>
</resources>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.sap.cloud</groupId>
<artifactId>neo-javaee7-wp-sdk</artifactId>
<version>${scp.sdkVersion}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${scp.sdkInstallPath}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</plugin>
<!-- Plugin for deployment to SAP Cloud Platform Neo. -->
<plugin>
<groupId>com.sap.cloud</groupId>
<artifactId>neo-javaee7-wp-maven-plugin</artifactId>
<version>${scp.sdkVersion}</version>
<executions>
<execution>
<id>stop</id>
<phase>install</phase>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<skip>${scp.skipRestart}</skip>
</configuration>
</execution>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<skip>${scp.skipDeploy}</skip>
<vmArguments>${scp.vmArguments}</vmArguments>
</configuration>
</execution>
<execution>
<id>start</id>
<phase>install</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<skip>${scp.skipRestart}</skip>
</configuration>
</execution>
<execution>
<id>rolling-update</id>
<phase>install</phase>
<goals>
<goal>rolling-update</goal>
</goals>
<configuration>
<skip>${scp.skipRollingUpdate}</skip>
</configuration>
</execution>
</executions>
<configuration>
<sdkInstallPath>${scp.sdkInstallPath}</sdkInstallPath>
<skip>${scp.skipInstallSdk}</skip>
<application>${scp.app}</application>
<source>${project.build.directory}/${project.build.finalName}.war</source>
<vmArguments>${scp.vmArguments}</vmArguments>
<size>${scp.vmSize}</size>
<minimumProcesses>${scp.vmMinProcesses}</minimumProcesses>
<maximumProcesses>${scp.vmMaxProcesses}</maximumProcesses>
<host>${scp.host}</host>
<account>${scp.account}</account>
<user>${scp.username}</user>
<password>${scp.password}</password>
<synchronous>true</synchronous>
<httpProxyHost>${proxy.host}</httpProxyHost>
<httpProxyPort>${proxy.port}</httpProxyPort>
<httpsProxyHost>${proxy.host}</httpsProxyHost>
<httpsProxyPort>${proxy.port}</httpsProxyPort>
<consoleCommand />
<consoleHttpProxyHost>${proxy.host}</consoleHttpProxyHost>
<consoleHttpProxyPort>${proxy.port}</consoleHttpProxyPort>
<consoleHttpsProxyHost>${proxy.host}</consoleHttpsProxyHost>
<consoleHttpsProxyPort>${proxy.port}</consoleHttpsProxyPort>
<dbsystem />
<dbSize />
<dbUser />
</configuration>
</plugin>
<!-- Plugin for deployment to local runtime of SAP Cloud Platform Neo. -->
<plugin>
<groupId>com.sap.cloud.sdk.plugins</groupId>
<artifactId>scp-neo-maven-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<sdkPlugin>neo-javaee7-wp-maven-plugin</sdkPlugin>
<sdkPluginVersion>${scp.sdkVersion}</sdkPluginVersion>
<sdkInstallPath>${scp.sdkInstallPath}</sdkInstallPath>
<sdkSymbolicLink>${scp.sdkSymbolicLink}</sdkSymbolicLink>
<sdkServerContentPath>${scp.sdkLocalServerContentPath}</sdkServerContentPath>
<source>${project.build.directory}/${project.build.finalName}.war</source>
<proxyHost>${proxy.host}</proxyHost>
<proxyPort>${proxy.port}</proxyPort>
<httpNonProxyHosts>${non.proxy.hosts}</httpNonProxyHosts>
<destinations>
<destination>
<path>${scp.sdkErpEndpoint}</path>
<username>achacon</username>
<password>*******</password>
<url>http://crmdev:4431</url>
</destination>
</destinations>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.sap.cloud.sdk.plugins</groupId>
<artifactId>usage-analytics-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>usage-analytics</goal>
</goals>
<configuration>
<skipUsageAnalytics>false</skipUsageAnalytics>
<generateSalt>true</generateSalt>
<!--
Note: A random salt is auto-generated once the project is built for the first time.
Please keep the generated salt in the POM file, for example, when pushing to git.
To learn more, visit: https://blogs.sap.com/2018/10/23/usage-analytics-s4sdk/
-->
<salt>5d5e4e1e8a5f05d547fe8880f65173bda150a670f91f3657b970eaa9e7a4d392</salt>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!--
Profiles that are used to set the Neo SDK "neo" command extension ("neo.sh" or "neo.cmd")
-->
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<scp.sdkNeoCmdExtension>.bat</scp.sdkNeoCmdExtension>
</properties>
</profile>
<profile>
<id>unix</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<scp.sdkNeoCmdExtension>.sh</scp.sdkNeoCmdExtension>
</properties>
</profile>
<!-- Profile setting properties for deploying to the local SAP CP runtime. -->
<profile>
<id>local-deploy</id>
<activation>
<property>
<name>!scp.app</name>
</property>
</activation>
<properties>
<scp.skipInstallSdk>true</scp.skipInstallSdk>
<scp.skipDeploy>true</scp.skipDeploy>
<scp.skipPutDestination>true</scp.skipPutDestination>
<scp.skipRestart>true</scp.skipRestart>
<scp.skipRollingUpdate>true</scp.skipRollingUpdate>
</properties>
</profile>
<!-- Profile setting properties for deploying a productive version to SAP CP. -->
<profile>
<id>scp-deploy</id>
<activation>
<property>
<name>productive</name>
</property>
</activation>
<properties>
<scp.skipInstallSdk>false</scp.skipInstallSdk>
<scp.skipDeploy>true</scp.skipDeploy>
<scp.skipPutDestination>false</scp.skipPutDestination>
<scp.skipRestart>true</scp.skipRestart>
<scp.skipRollingUpdate>false</scp.skipRollingUpdate>
</properties>
</profile>
</profiles>
</project>
This is my ErpQueryEndpoint file: https://i.imgur.com/jIWsa4o.jpg
Thanks for the good question. The first thing I've noticed you're using an already quite outdated version of the SDK, the current one is 3.14.0, you're on the 3.2.0 at the moment. We do a lot of fixes with every release and I would recommend
switching to the latest one in your dependencies. Take a look in our release notes
In regards to Resilience, it's hard to tell exactly why the load test might fail because you use SDK on quite a low level by invoking an un-typed request builder that is not maintained by the SDK team. For Odata V2 ODataCreateRequestImpl is a dependency and not meant for direct consumption. We expose it only for edge cases and convenience.
A more reliable way to use SDK would be to generate a Virtual Data Model from your service definition first and then build typed requests. Those should be more
reliably implemented and easier to debug.
Is it an option for you to generate the Virtual Data Model first and use the preferable way of building requests? This tutorial covers the topic of the way SDK is intended to be used for the most use cases
Here is the tutorial covering basic Resilience setup
I'll see if I can find more ideas about this case, in the meanwhile updating the SDK version and checking if you can use typed request builders mentioned in the tutorials above for CRUD would be a good idea.
If you have any additional details that might shed more light on this case, feel free to share them.
Thank you very much for your response, Kovalyov. I updated to version 3.14.0 of SAP Cloud SDK as you suggested, that was part of the solution to my problem.
After upgrading to version 3.14.0 of SAP Cloud SDK, I tried starting the local SCP deployment, however, I got an error. The solution to the error was to eliminate the following dependency of my pom.xml:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
Additionally, it was necessary to replace the following instruction in my code:
CompletableFuture<Object> futureFirstStep = ResilienceDecorator.queueCallable(() ->
executeAsyncCall(bpCreateRequest), conf);
With this instruction:
new Thread(() -> {
some instruction;
}).start();

How to run junit tests on a non java project

I have a project folder but it is not a java project. It is a maven project. I have written a junit test and it runs perfectly when running in the eclipse IDE but when I run the maven command mvn install, it seems to skip my junit tests. I have included the test file in src/test/java/ (the name of my test is AppTest.java) and the main .java file (with the main method) is in src/main/java/. I have noticed that the project I am currently working on is a maven project and not a maven java project. I have included a screen of my current folder structure:
folder structure
Maven test output <- should not build as I have a deliberate test that should fail
This is the POM. I have deleted/commented out some sensitive parts so the pom file may be syntactically wrong but the main plugins I use are there; tap4j, junit and surefire.
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>integration-api-parent</artifactId>
<groupId>uk.gov.dwp</groupId>
<version>1.0.2</version>
</parent>
<artifactId>aa</artifactId>
<version>1.0.6</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>aa</finalName>
<plugins>
<!-- plugin>
<groupId>com.github.fracpete</groupId>
<artifactId>latex-maven-plugin</artifactId>
<configuration>
<forceBuild>true</forceBuild>
</configuration>
</plugin>
<plugin>
<groupId>com.github.fracpete</groupId>
<artifactId>latex-maven-plugin</artifactId>
<configuration>
<forceBuild>true</forceBuild>
</configuration>
</plugin-->
<plugin>
<!-- Plug-in utilised for the execution of the JMeter Integration Tests -->
<!-- These tests are executed against the nominated integration server where as -->
<!-- instance of AA exists -->
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<ignoreResultErrors>false</ignoreResultErrors>
<suppressJMeterOutput>false</suppressJMeterOutput>
<overrideRootLogLevel>INFO</overrideRootLogLevel>
</configuration>
</plugin>
<plugin>
<!-- Step to copy the latest plug-ins that form this build to the integration server -->
<!-- This is done using the SCP command via the ANT plug-in thus allowing it to execute on all platforms -->
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.42</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.tap4j/tap4j -->
<dependency>
<groupId>org.tap4j</groupId>
<artifactId>tap4j</artifactId>
<version>4.2.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<!-- plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/cassandra-assembly.xml</descriptor>
<descriptor>src/main/assembly/devenv-assembly.xml</descriptor>
<descriptor>src/main/assembly/main-assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
<!-- plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<configuration>
<skipPoms>false</skipPoms>
<sourceDirectory>${project.basedir}/src/main/latex-templates</sourceDirectory>
<outputDirectory>${project.build.directory}/latex</outputDirectory>
</configuration>
</plugin-->
</plugins>
</build>
</project>
AppTest:
package AccessGateway;
import static org.junit.Assert.*;
import java.io.File;
import org.junit.Test;
import org.tap4j.consumer.TapConsumer;
import org.tap4j.consumer.TapConsumerFactory;
import org.tap4j.model.TestSet;
public class AppTest {
Practise prac;
final String DIRECTORY = "C:\\Users\\Hello\\Desktop\\";
#Test
public void testHeaderProcessor() {
prac = new Practise();
assertFalse(prac.runTest(new File(DIRECTORY+"TAPHeaderProcessor.txt")));
}
#Test
public void testHeaderPortForward() {
prac = new Practise();
assertFalse(prac.runTest(new File(DIRECTORY+"TAPHeaderPortForward.txt")));
}
#Test
public void catunittest() {
prac = new Practise();
assertFalse(prac.runTest(new File(DIRECTORY+"catunittest.txt")));
}
#Test
public void catunitcrowstest() {
prac = new Practise();
assertFalse(prac.runTest(new File(DIRECTORY+"catcrowd.txt")));
}
#Test
public void testCrowd() {
prac = new Practise();
assertFalse(
prac.runTest(new File(DIRECTORY+"TAPCrowd.txt")));
}
#Test
public void testADFS() {
prac = new Practise();
assertFalse(
prac.runTest(new File(DIRECTORY+"TAPADFSformat.txt")));
}
}
The problem is the packaging of your project which is pom
You can't execute Surefire on this kind of project.
Try adding surefire plugin. When i have tests in my app i always include it (works for junit as well as testng). Based on your logs i can see that you dont have it declared.
<plugins>
[...]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>

vertx run with metrics enabled in cluster

OS: Linux
Vert.x Version: 3.3.3
Machines: Two different with
different IP within same subnet
I want to enable metrics monitoring for an simple ping-pong application, where I can watch how many packets were sent between the two nodes.
The measured metrics should be pushed over the eventbus and consumed by a website, providing a dashboard. Copied from the vertx examples on Github
Starting apps with following commands
Sender:
vertx run de.avm.boundary.Sender -cluster -cp target/vertx-ping-pong-3.3.3-fat.jar -Dvertx.metrics.options.enabled=true
Receiver
vertx run de.avm.boundary.Receiver -cluster -cp target/vertx-ping-pong-3.3.3-fat.jar
doesn't provide any metrics.
Source Code
Sender.java
package de.avm.boundary;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpServer;
import io.vertx.core.json.JsonObject;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.ext.dropwizard.MetricsService;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.handler.StaticHandler;
import io.vertx.ext.web.handler.sockjs.BridgeOptions;
import io.vertx.ext.web.handler.sockjs.PermittedOptions;
import io.vertx.ext.web.handler.sockjs.SockJSHandler;
public class Sender extends AbstractVerticle {
Logger logger = LoggerFactory.getLogger(getClass().getSimpleName());
#Override
public void start() {
Vertx.currentContext().config();
System.out.println("START SENDER VERTICLE DEPLOYMENT ID: " + deploymentID());
BridgeOptions bridgeOptions = new BridgeOptions().
addOutboundPermitted(
new PermittedOptions().
setAddress("metrics-sender")
).addOutboundPermitted(new PermittedOptions().
setAddressRegex("metrics-receiver")
);
Router router = Router.router(vertx);
router.route("/eventbus/*").handler(SockJSHandler.create(vertx).bridge(bridgeOptions));
router.route().handler(StaticHandler.create());
HttpServer httpServer = vertx.createHttpServer();
httpServer.requestHandler(router::accept).listen(8080);
//why is the service object null ??
MetricsService service = MetricsService.create(vertx.eventBus());
System.out.println("Metrics-Service: " + service);
vertx.setPeriodic(100, new Handler<Long>() {
#Override
public void handle(Long timerID) {
vertx.eventBus().publish("ping-address", "more news! at: " + System.currentTimeMillis());
}
});
vertx.setPeriodic(1000, new Handler<Long>() {
#Override
public void handle(Long timerID) {
JsonObject metrics = service.getMetricsSnapshot(vertx);
vertx.eventBus().publish("metrics-sender", metrics);
System.out.println("Metrics: " + metrics);
}
});
}
}
Receiver.java
package de.avm.boundary;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.eventbus.Message;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.dropwizard.MetricsService;
public class Receiver extends AbstractVerticle {
MetricsService service = MetricsService.create(vertx);
#Override
public void start() {
System.out.println("START RECEIVER VERTICLE DEPLOYMENT ID: " + deploymentID());
vertx.eventBus().consumer("ping-address", new Handler<Message<String>>() {
#Override
public void handle(Message<String> message) {
// Reply to it
System.out.println("Received message: " + message.body());
message.reply("pong!");
}
}).completionHandler(new Handler<AsyncResult<Void>>() {
#Override
public void handle(AsyncResult<Void> event) {
if (event.succeeded()) {
System.out.println("Eventbus registration complete!");
}
}
});
// Send a metrics events every second
vertx.setPeriodic(1000, t -> {
JsonObject metrics = service.getMetricsSnapshot(vertx.eventBus());
vertx.eventBus().publish("metrics-receiver", metrics);
});
}
}
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>de.avm</groupId>
<artifactId>vertx-ping-pong</artifactId>
<version>3.3.3</version>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-dropwizard-metrics</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-hazelcast</artifactId>
<version>${project.version}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-lang-js</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Launcher</Main-Class>
<Main-Verticle>de.avm.boundary.Sender</Main-Verticle>
</manifestEntries>
</transformer>
</transformers>
<artifactSet/>
<outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
How can I enable Metrics?
Solved the problem by changing starting appliaction, especially the Sender an Receiver Verticles, in another war.
The best solution for me was starting the application with
Sender:
java -jar target/vertx-ping-pong-3.3.3-Sender-fat.jar -cluster -Dvertx.metrics.options.enabled=true
Receiver
java -jar target/vertx-ping-pong-3.3.3-Receiver-fat.jar -cluster -Dvertx.metrics.options.enabled=true
The pitfall is, that you must tell maven, especially the shade plugin, which them main class is. I have achieved this by defining a placeholder within the properties part in the pom.xml and passing the name of the main Vericle during maven build execution.
mvn package -DmainClass=Sender
This also results to place a fat-jar withing the target folder where the name of the passed parameter is included in the file name.
Here the modified 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>de.avm</groupId>
<artifactId>vertx-ping-pong</artifactId>
<version>3.3.3</version>
<properties>
<runWithClass>${mainClass}</runWithClass>
</properties>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-dropwizard-metrics</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-hazelcast</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-lang-js</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Launcher</Main-Class>
<Main-Verticle>de.avm.boundary.${runWithClass}</Main-Verticle>
</manifestEntries>
</transformer>
</transformers>
<artifactSet/>
<outputFile>${project.build.directory}/${project.artifactId}-${project.version}-${runWithClass}-fat.jar</outputFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

Categories