This is an automated email from the ASF dual-hosted git repository. cdutz pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 31e35c02d036415e09875743f784ecee8486bbed Author: Christofer Dutz <[email protected]> AuthorDate: Thu Aug 15 14:02:18 2019 +0200 - Updated the build to produce a gem file usable by logstash --- plc4j/integrations/logstash-plugin/pom.xml | 55 +++++++++++++++++----- .../src/gem/lib/logstash-input-plc4x_jars.rb | 21 +++++++++ .../src/gem/lib/logstash/inputs/plc4x.rb | 29 ++++++++++++ 3 files changed, 92 insertions(+), 13 deletions(-) diff --git a/plc4j/integrations/logstash-plugin/pom.xml b/plc4j/integrations/logstash-plugin/pom.xml index 99a51fc..936044b 100644 --- a/plc4j/integrations/logstash-plugin/pom.xml +++ b/plc4j/integrations/logstash-plugin/pom.xml @@ -35,6 +35,29 @@ <build> <plugins> + <!-- Prepare the gemspec file containing the project information --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>generate-gem-resources</id> + <phase>generate-resources</phase> + <goals> + <goal>resources</goal> + </goals> + <configuration> + <resources> + <resource> + <directory>src/gem</directory> + <filtering>true</filtering> + <targetPath>${project.build.directory}/gem</targetPath> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> <!-- Create a fat-jar containing all the dependencies --> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -42,7 +65,7 @@ <executions> <execution> <id>assemble-all</id> - <phase>package</phase> + <phase>prepare-package</phase> <goals> <goal>single</goal> </goals> @@ -50,29 +73,35 @@ <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> + <outputDirectory>${project.build.directory}/gem/vendor/jar-dependencies/org/apache/plc4x/logstash-input-plc4x/${project.version}</outputDirectory> + <finalName>logstash-input-plc4x-${project.version}</finalName> + <appendAssemblyId>false</appendAssemblyId> + <attach>false</attach> </configuration> </execution> </executions> </plugin> - <!-- Prepare the gemspec file containing the project information --> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <classesDirectory>${project.build.directory}/gem</classesDirectory> + </configuration> + </plugin> + <plugin> + <groupId>com.coderplus.maven.plugins</groupId> + <artifactId>copy-rename-maven-plugin</artifactId> + <version>1.0</version> <executions> <execution> - <id>build-gem</id> - <phase>pre-integration-test</phase> + <id>rename-file</id> + <phase>generate-sources</phase> <goals> - <goal>resources</goal> + <goal>rename</goal> </goals> <configuration> - <resources> - <resource> - <directory>src/gem</directory> - <filtering>true</filtering> - <targetPath>${project.build.directory}/gem</targetPath> - </resource> - </resources> + <sourceFile>${project.build.directory}/${project.build.finalName}.jar</sourceFile> + <destinationFile>${project.artifactId}-${project.version}.gem</destinationFile> </configuration> </execution> </executions> diff --git a/plc4j/integrations/logstash-plugin/src/gem/lib/logstash-input-plc4x_jars.rb b/plc4j/integrations/logstash-plugin/src/gem/lib/logstash-input-plc4x_jars.rb new file mode 100644 index 0000000..a1a0836 --- /dev/null +++ b/plc4j/integrations/logstash-plugin/src/gem/lib/logstash-input-plc4x_jars.rb @@ -0,0 +1,21 @@ +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +require 'jar_dependencies' +require_jar('${project.groupId}', 'logstash-input-plc4x', '${project.version}') \ No newline at end of file diff --git a/plc4j/integrations/logstash-plugin/src/gem/lib/logstash/inputs/plc4x.rb b/plc4j/integrations/logstash-plugin/src/gem/lib/logstash/inputs/plc4x.rb new file mode 100644 index 0000000..8227271 --- /dev/null +++ b/plc4j/integrations/logstash-plugin/src/gem/lib/logstash/inputs/plc4x.rb @@ -0,0 +1,29 @@ +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +require "logstash/inputs/base" +require "logstash/namespace" +require "logstash-input-java_input_example_jars" +require "java" + +class LogStash::Inputs::Plc4xInput < LogStash::Inputs::Base + config_name "plc4x" + + def self.javaClass() org.apache.plc4x.logstash.Plc4xInput.java_class; end +end
