| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| |
| 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. |
| |
| --> |
| <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> |
| |
| <parent> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-integrations</artifactId> |
| <version>0.8.0</version> |
| </parent> |
| |
| <artifactId>plc4j-logstash-plugin</artifactId> |
| |
| <name>PLC4J: Integrations: Logstash plugin</name> |
| <description>Integration module for integrating PLC4X into Elastic Logstash.</description> |
| |
| <properties> |
| <jruby.version>9.2.8.0</jruby.version> |
| </properties> |
| |
| <build> |
| <plugins> |
| <!-- |
| As ruby and gem seem to have problems with Maven SNAPSHOT versions, |
| calculate how the version would be without the "SNAPSHOT" prefix and |
| make this available in the property "current-full-version". |
| --> |
| <plugin> |
| <groupId>org.codehaus.gmaven</groupId> |
| <artifactId>groovy-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>provide-custom-properties</id> |
| <phase>validate</phase> |
| <goals> |
| <goal>execute</goal> |
| </goals> |
| <configuration> |
| <source> |
| // Calculate some version related stuff |
| def currentVersion = project.version as String |
| def match = (currentVersion =~ /(\d+)\.(\d+)\.(\d+)(-SNAPSHOT)?/) |
| print "\nCurrent version: " + currentVersion |
| if (match.count >= 1) { |
| def majorVersion = match[0][1] as Integer |
| def minorVersion = match[0][2] as Integer |
| def bugfixVersion = match[0][3] as Integer |
| |
| def currentFullVersion = majorVersion + "." + minorVersion + "." + bugfixVersion |
| |
| print "\nCurrent full version: " + currentFullVersion + " (current-full-version)" |
| project.properties['current-full-version'] = currentFullVersion |
| } |
| print "\n" |
| </source> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <!-- Download and unpack JRuby --> |
| <plugin> |
| <groupId>com.googlecode.maven-download-plugin</groupId> |
| <artifactId>download-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>get-jruby</id> |
| <!-- Only execute this for the parent module --> |
| <inherited>false</inherited> |
| <phase>generate-resources</phase> |
| <goals> |
| <goal>wget</goal> |
| </goals> |
| <configuration> |
| <url> |
| https://repo1.maven.org/maven2/org/jruby/jruby-dist/${jruby.version}/jruby-dist-${jruby.version}-bin.tar.gz |
| </url> |
| <unpack>true</unpack> |
| <outputDirectory>${project.build.directory}/jruby</outputDirectory> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <!-- Prepare all the resources the gem build needs --> |
| <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> |
| <!-- Build a fat jar containing all dependencies --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-shade-plugin</artifactId> |
| <executions> |
| <execution> |
| <phase>package</phase> |
| <goals> |
| <goal>shade</goal> |
| </goals> |
| <configuration> |
| <!-- Ignore the error ... this variable is calculated in the "validate" phase --> |
| <outputFile> |
| ${project.build.directory}/gem/vendor/jar-dependencies/org/apache/plc4x/logstash-input-plc4x/${current-full-version}/logstash-input-plc4x-${current-full-version}.jar |
| </outputFile> |
| <!-- The output is just an intermediate file, so make sure it's not installed or deployed --> |
| <shadedArtifactAttached>false</shadedArtifactAttached> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <!-- Execute the Gem build using JRuby --> |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>exec-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>run-gem-build</id> |
| <phase>package</phase> |
| <goals> |
| <goal>exec</goal> |
| </goals> |
| <configuration> |
| <executable>../jruby/jruby-${jruby.version}/bin/jruby</executable> |
| <arguments> |
| <argument>-S</argument> |
| <argument>../jruby/jruby-${jruby.version}/bin/gem</argument> |
| <argument>build</argument> |
| <argument>logstash-input-plc4x.gemspec</argument> |
| </arguments> |
| <workingDirectory>${project.build.directory}/gem</workingDirectory> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <!-- Manually tell maven to add the gem artifact built by JRuby and Gem --> |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>build-helper-maven-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>attach-gem</id> |
| <phase>package</phase> |
| <goals> |
| <goal>attach-artifact</goal> |
| </goals> |
| <configuration> |
| <artifacts> |
| <artifact> |
| <!-- Ignore the error ... this variable is calculated in the "validate" phase --> |
| <file>${project.build.directory}/gem/logstash-input-plc4x-${current-full-version}.gem</file> |
| <type>gem</type> |
| </artifact> |
| </artifacts> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <!-- |
| We are referencing libraries that are not directly used, we have to tell the dependency |
| plugin that they are used and it shouldn't complain and break the build. |
| --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-dependency-plugin</artifactId> |
| <configuration> |
| <usedDependencies combine.children="append"> |
| <usedDependency>org.apache.plc4x:plc4j-driver-ab-eth</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-ads</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-canopen</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-eip</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-firmata</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-knxnetip</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-modbus</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-opcua</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-s7</usedDependency> |
| <usedDependency>org.apache.plc4x:plc4j-driver-simulated</usedDependency> |
| </usedDependencies> |
| </configuration> |
| </plugin> |
| </plugins> |
| </build> |
| |
| <dependencies> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-api</artifactId> |
| <version>0.8.0</version> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-connection-pool</artifactId> |
| <version>0.8.0</version> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-scraper</artifactId> |
| <version>0.8.0</version> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4x-tools-logstash-core</artifactId> |
| <version>0.8.0</version> |
| <classifier>${logstash.version}</classifier> |
| </dependency> |
| |
| <!-- Include all drivers --> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-ab-eth</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-ads</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-canopen</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-eip</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-firmata</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-knxnetip</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-modbus</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-opcua</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-s7</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4j-driver-simulated</artifactId> |
| <version>0.8.0</version> |
| <scope>runtime</scope> |
| </dependency> |
| </dependencies> |
| |
| </project> |