简体   繁体   中英

JavaFX with CDI, JPA and javafx-maven-plugin

I build and run my app with mvn jfx:run but i would like to add CDI to it. Now running it ends with Missing beans.xml file in META-INF!

Is there any way to make it add files from META-INF to jar? Or maybe there is an alternative way of building javafx apps with maven(without antrun)?

Here is 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/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>pl.arenatd</groupId>
<artifactId>ArenaTD_Manager</artifactId>
<name>ArenaTD_Manager</name>

<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>

<organization>
    <!-- Used as the 'Vendor' for JNLP generation -->
    <name>arenatd</name>
</organization>

<properties>
    <slf4j.version>1.6.1</slf4j.version>
</properties>

<build>

    <finalName>ArenaTD_Manager</finalName>

    <plugins>

        <plugin>
            <groupId>com.zenjava</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>2.0</version>
            <configuration>
                <mainClass>pl.arenatd.manager.MainApp</mainClass>
            </configuration>
        </plugin>

    </plugins>
</build>


<dependencies>

    <!-- Apache Commons -->

    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>

    <!-- Logging  -->

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>

    <!-- JPA -->
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.1.Final</version>
    </dependency>

    <!-- CDI -->
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.weld</groupId>
        <artifactId>weld-core</artifactId>
        <version>2.1.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.weld.se</groupId>
        <artifactId>weld-se</artifactId>
        <version>2.1.0.Final</version>
    </dependency>

</dependencies>

</project>

尝试将正确的beans.xml文件添加到src / main / resources / META-INF

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM