Не могу добавить JavaFX в проект Maven с OSGi - PullRequest
0 голосов
/ 22 февраля 2019

Я работаю с Java 8 в проекте, который требует некоторых библиотек из JavaFX, проблема в том, что я уже добавил некоторые другие библиотеки, такие как JFreeChart, в свой проект и мне нужно только импортировать jar и все зависимости.

Однако с JavaFX я не могу этого сделать, я пропустил несколько зависимостей, таких как osgi.wiring.package=org.w3c.dom.html, но я не могу решить эту проблему, так как бы это был правильный способ работы с Maven, OSGi и JavaFX?

Я оставил файл pom, чтобы вы могли видеть, как я его настраиваю.

<?xml version="1.0"?>
<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.EconTech</groupId>
<artifactId>Dashboard</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Inside Dashboard</name>
<packaging>bundle</packaging>

<properties>

    <!--********************************************************************-->
    <!--   Note: Update this section with relevant meta data                -->
    <!--         that comes along with your URCap                           -->
    <!--********************************************************************-->
    <!--******************* BEGINNING OF URCAP META DATA *******************-->
    <urcap.symbolicname>com.EconTech.Dashboard</urcap.symbolicname>
    <urcap.vendor>Econ Tech S.A. de C.V.</urcap.vendor>
    <urcap.contactAddress>info@econ-tech.com</urcap.contactAddress>
    <urcap.copyright>Copyright © 2019 ECON Tech. All rights reserved.</urcap.copyright>
    <urcap.description>Shows and saves robot information inside itself</urcap.description>
    <urcap.licenseType>Apache License 2.0</urcap.licenseType>
    <!--********************** END OF URCAP META DATA **********************-->
    <!--********************************************************************-->

    <!-- Host, username and password of the robot to be used when running "mvn install -Premote" -->

    <urcap.install.host>localhost</urcap.install.host>
    <urcap.install.username>root</urcap.install.username>
    <urcap.install.password>easybot</urcap.install.password>

    <!-- <ursimvm.install.host></ursimvm.install.host>
    <ursimvm.install.username>ur</ursimvm.install.username>
    <ursimvm.install.password>easybot</ursimvm.install.password>-->

    <!--Install path for the UR Sim-->
    <ursim.home></ursim.home>

    <!--Host and standard user/password for UR Sim running in a VM-->
    <ursimvm.install.host></ursimvm.install.host>
    <ursimvm.install.username>ur</ursimvm.install.username>
    <ursimvm.install.password>easybot</ursimvm.install.password>
</properties>

<build>
    <plugins>
        <!-- Plugin for maven and JDK 1.8-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.1</version>
            <configuration>
                <runOrder>alphabetical</runOrder>
                <useSystemClassLoader>false</useSystemClassLoader>
                <includes>
                    <include>**/JFreeChartTestSuite.java</include>
                </includes>
            </configuration>
        </plugin>
        <!-- Este plugin es para agregar jars  
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>-->

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.0</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin> 
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.0.2</version>
            <configuration>
                <archive>
                    <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.0.2</version>
        </plugin>

        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.4.0</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <id>bundle-manifest</id>
                    <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                </execution>
            </executions>
            <configuration>
                <instructions>
                    <!--********** DO NOT MODIFY THE ENTRIES OF THIS SECTION **********-->
                    <Bundle-Category>URCap</Bundle-Category>
                    <Bundle-Activator>com.EconTech.Dashboard.impl.Activator</Bundle-Activator>
                    <Bundle-Vendor>${urcap.vendor}</Bundle-Vendor>
                    <Bundle-ContactAddress>${urcap.contactAddress}</Bundle-ContactAddress>
                    <Bundle-Copyright>${urcap.copyright}</Bundle-Copyright>
                    <Bundle-LicenseType>${urcap.licenseType}</Bundle-LicenseType>
                    <Bundle-Description>${urcap.description}</Bundle-Description>
                    <!--***************************************************************-->
                    <Import-Package>
                        com.ur.urcap.api*;version="[1.4.0,2.0.0)", org.jfree.jfreechart*;resolution:=optional, 
                        org.jfree.jcommon*;resolution:=optional, javax.servlet.*;resolution:=optional, 
                        eu.hansolo.Medusa*;resolution:=optimal, com.oracle.javafx*;resolution:=optimal,
                        org.eclipse.platform*;resolution:=optimal, org.w3c.dom*;resolution:=optimal,
                        <!-- org.openjfx.javafx-controls*;resolution:=optimal, !com.EconTech.Dashboard.jfreechart-1.0.19.*, !com.EconTech.Dashboard.jcommon-1.0.23.*, --> 
                        *
                    </Import-Package>
                    <!--  !org.openjfx.javafx-controls, -->
                    <Embed-Dependency>
                        !org.jfree.jfreechart, !org.jfree.jcommon, !javax.servlet, 
                        !com.oracle.javafx, !org.osgi.core, !com.ur.urcap.api, 
                        !org.eclipse.platform, !org.w3c.dom; scope=compile|runtime
                    </Embed-Dependency>
                </instructions>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <!-- generate URCap package after compiling -->
                <execution>
                    <id>package-urcap</id>
                    <phase>package</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>cp</executable>
                            <commandlineArgs>target/${project.build.finalName}.jar target/${project.build.finalName}.urcap</commandlineArgs>
                        <workingDirectory>.</workingDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- JavaFX Dependency-->
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>javafx</artifactId>
        <version>8.0.60</version>
    </dependency>

    <!-- Eclipse SWT Dependency-->
    <dependency>
        <groupId>org.eclipse.platform</groupId>
        <artifactId>org.eclipse.swt</artifactId>
        <version>3.106.3</version>
    </dependency>

    <!-- Eclipse SWT Dependency
    <dependency>
        <groupId>org.w3c.dom</groupId>
        <artifactId>org.w3c.dom.css</artifactId>
        <version>1.0</version>
    </dependency>-->

    <dependency>
        <groupId>org.w3c</groupId>
        <artifactId>dom</artifactId>
        <version>2.3.0-jaxb-1.0.6</version>
    </dependency>

    <!-- <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-base</artifactId>
        <version>11.0.2</version>
    </dependency>

    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-graphics</artifactId>
        <version>11.0.2</version>
    </dependency> -->

    <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.core</artifactId>
        <version>4.3.0</version>
    </dependency>

    <!-- jcommon Dependency-->
    <dependency>
        <groupId>org.jfree</groupId>
        <artifactId>jcommon</artifactId>
        <version>1.0.23</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>


    <!-- Medusa Dependency for gauges-->
    <dependency>
        <groupId>eu.hansolo</groupId>
        <artifactId>Medusa</artifactId>
        <version>8.3</version>
    </dependency>

    <!-- jfreechart Dependency -->
    <dependency>
        <groupId>org.jfree</groupId>
        <artifactId>jfreechart</artifactId>
        <version>1.0.19</version>
    </dependency>

    <dependency>
        <groupId>com.ur.urcap</groupId>
        <artifactId>api</artifactId>
        <version>1.4.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.xmlrpc</groupId>
        <artifactId>xmlrpc-client</artifactId>
        <version>3.1.3.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.xmlrpc</groupId>
        <artifactId>xmlrpc-common</artifactId>
        <version>3.1.3.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.antlr</groupId>
                <artifactId>stringtemplate</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.antlr</groupId>
                <artifactId>antlr-runtime</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.apache.ws.commons.util</groupId>
        <artifactId>ws-commons-util</artifactId>
        <version>1.0.2.0</version>
        <exclusions>
            <exclusion>
                <artifactId>xml-apis</artifactId>
                <groupId>xml-apis</groupId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1.0.0</version>
    </dependency>

    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.9</version>
    </dependency>

    <!-- test dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<profiles>
    <profile>
        <id>remote</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.1</version>
                    <executions>
                        <execution>
                            <id>remote-install-urcap</id>
                            <phase>install</phase>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>sshpass</executable>
                                <commandlineArgs>-p ${urcap.install.password} scp -o StrictHostKeyChecking=no target/${project.build.finalName}.jar ${urcap.install.username}@${urcap.install.host}:/root/.urcaps/${urcap.symbolicname}.jar</commandlineArgs>
                                <workingDirectory>.</workingDirectory>
                            </configuration>
                        </execution>
                        <execution>
                            <id>remote-restart-ui</id>
                            <phase>install</phase>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>sshpass</executable>
                                <commandlineArgs>-p ${urcap.install.password} ssh ${urcap.install.username}@${urcap.install.host} pkill java</commandlineArgs>
                                <workingDirectory>.</workingDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>local</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.1</version>
                    <executions>
                        <execution>
                            <id>local-install-urcap</id>
                            <phase>install</phase>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>cp</executable>
                                <commandlineArgs>target/${project.build.finalName}.jar ${user.home}/.urcaps/${urcap.symbolicname}.jar</commandlineArgs>
                                <workingDirectory>.</workingDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>ursim</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.1</version>
                    <executions>
                        <execution>
                            <id>ursim-install-urcap</id>
                            <phase>install</phase>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>cp</executable>
                                <commandlineArgs>target/${project.build.finalName}.jar ${ursim.home}/.urcaps/${urcap.symbolicname}.jar</commandlineArgs>
                                <workingDirectory>.</workingDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>ursimvm</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.1</version>
                    <executions>
                        <execution>
                            <id>ursimvm-install-urcap</id>
                            <phase>install</phase>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>sshpass</executable>
                                <commandlineArgs>-p ${ursimvm.install.password} scp -o StrictHostKeyChecking=no target/${project.build.finalName}.jar ${ursimvm.install.username}@${ursimvm.install.host}:/home/ur/ursim-current/.urcaps/${urcap.symbolicname}.jar</commandlineArgs>
                                <workingDirectory>.</workingDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...