如何下载快照版本?

How to download snapshot release?

我从不下载快照版本。但是为了实现 a project I have to use RichText.

我想下载 snapshot 版本来使用。因为在以前的版本中 import org.fxmisc.richtext.model.StyledSegment; 未被 IntelliJ IDE.

找到

我对快照发布一无所知,maven,gradle。
我只需要最新版本的 jar 文件。

请直接给我获取jar文件的建议。

编辑
现在我想 运行 至少 RichText.java

你正在使用 ANT build tool. Even if there is a way to use maven dependencies in the Ant (see this question) 如果你不限制使用 ant,我建议将项目转移到 maven 或 gradle。

尽管如此:

如果你想使用Maven:

  • create new maven project in IDEA
  • 添加所需的 Sonatype 快照存储库和您要使用的快照依赖项
  • 示例pom.xml

    <dependencies>
        <dependency>
            <groupId>org.fxmisc.richtext</groupId>
            <artifactId>richtextfx</artifactId>
            <version>1.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
    
    <repositories>
        <repository>
            <id>sonatype-snapshots</id>
            <name>Sonatype Public</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    

如果你想使用Gradle:

  • create new gradle project in IDEA
  • 示例build.gradle

    repositories {
        mavenCentral()
        maven {
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
    }
    
    dependencies {
        testCompile group: 'junit', name: 'junit', version: '4.12'
        compile group: 'org.fxmisc.richtext', name: 'richtextfx', version: '1.0.0-SNAPSHOT'
    }
    

编辑

Maven 关注 standard directory structure. You need to have pom.xml in the root directory, source java files in src/main/java, resources like png and css in src/main/resources. If you want to execute main class you can use Exec maven plugin where you can specify your main class. See image

当你想要运行你的申请时:

  1. 可选择清理以前的构建 - clean
  2. 构建项目 - package
  3. 运行 带有 exec 插件的应用程序 - exec:java

或者如果你更喜欢终端,你可以使用 mvn clean package exec:java