maven build

时间:2015-06-24 20:57:51

标签: eclipse maven javafx classnotfoundexception jfxtras

我正在使用Eclipse与Maven集成,并在我的项目中包含JFXtras。当我进行maven构建时,它成功创建了jar,但是当我尝试运行它时,我得到了一个

java.lang.ClassNotFoundException: jfxtras.scene.control.ListSpinner

我整合了如下所述的jfxtras: http://mvnrepository.com/artifact/org.jfxtras/jfxtras-labs/8.0-r3

编辑:

<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>propgr</groupId>
  <artifactId>Project</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
  <dependency>
    <groupId>org.jfxtras</groupId>
    <artifactId>jfxtras-labs</artifactId>
    <version>8.0-r1</version>
</dependency>
<dependency>
    <groupId>org.jfxtras</groupId>
    <artifactId>jfxtras-controls</artifactId>
    <version>8.0-r1</version>
</dependency>
<dependency>
    <groupId>org.jfxtras</groupId>
    <artifactId>jfxtras-common</artifactId>
    <version>8.0-r1</version>
</dependency>

</dependencies>
  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>main.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

任何想法/帮助?

1 个答案:

答案 0 :(得分:2)

JFXtras由许多神器组成;实验室,控件,常见,......,它们之间有一些依赖关系。实验室的依赖性缺失。下面的pom适合我。

<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>propgr</groupId>
    <artifactId>Project</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.jfxtras</groupId>
            <artifactId>jfxtras-labs</artifactId>
            <version>8.0-r3</version>
        </dependency>
    </dependencies>
    <build>
        ...
   </build>
</project>

对于发行版,如果要使用快照,则需要在pom或.m2 / settings.xml中添加Sonatype快照存储库

<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>propgr</groupId>
    <artifactId>Project</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.jfxtras</groupId>
            <artifactId>jfxtras-labs</artifactId>
            <version>8.0-r4-SNAPSHOT</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>oss-sonatype</id>
            <name>oss-sonatype</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <build>
        ...
   </build>
</project>