2017-10-08 103 views
1

我從不下載快照版本。但爲了實施a project我必須使用RichText如何下載快照版本?

我想下載snapshot的版本以供使用。因爲IntelliJ IDE找不到以前版本import org.fxmisc.richtext.model.StyledSegment;

我對快照發布,maven,gradle一無所知。
我只需要最新版本的jar文件。

請給我一個獲取jar文件的直接建議。

編輯
現在我想至少運行RichText.java

回答

1

您正在使用ANT build tool。即使有一種方法可以在Ant中使用Maven依賴關係(請參閱此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。你需要在根目錄下有pom.xml,在src/main/java的源java文件,像src/main/resources中的png和css這樣的資源。如果你想執行主類,你可以使用Exec maven plugin,你可以指定你的主類。見image

當你想運行應用程序:

  1. 隨時清除以前的版本 - clean
  2. 建設項目 - package
  3. 運行與Exec插件的應用 - exec:java

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

+0

我使用maven,但結果是[this](https://imgur.com/uveWDwe)。 – alhelal

+0

如果你使用Maven,你的'pom.xml'在哪裏?沒有它你不能使用Maven。 –

+0

@alhelal我編輯了答案,我希望它有幫助。 – xstefank