2014-08-30 13 views

回答

1

我有同樣的問題,並閱讀手冊我發現對我工作的解決方案。

我使用的是JSF項目與Spring 3,與NetBeans和運行JRebel的通過IDE

注意的意見是,我以前嘗試過的東西,它不會是行不通的手段。

這裏最重要的是增加了資源路徑的進入類路徑和自動JRebel的是置於網絡節點的鏈接標籤的消除。

rebel.xml:

<application generated-by="netbeans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://www.zeroturnaround.com" 
    xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd"> 

<classpath> 
    <!--<dir name="/path_to_project_root/target/classes"></dir>--> 
    <dirset dir="/path_to_project_root/"> 
     <include name="**/target/classes"/> 
     <include name="**/src/main/resources"/> 
    </dirset> 
    </classpath> 

    <web> 
    <!--<link target="/">--> 
     <dir name="/path_to_project_root/src/main/webapp"></dir> 
     <dir name="/path_to_project_root/src/main/resources"></dir> 
    <!--</link>--> 
    </web> 

</application> 

此外,我配置的插件在pom.xml,屬性addResourcesDirToRebelXml設置爲true

的pom.xml:

<plugin> 
    <groupId>org.zeroturnaround</groupId> 
    <artifactId>jrebel-maven-plugin</artifactId> 
    <version>1.1.7</version> 
    <configuration> 
     <addResourcesDirToRebelXml>true</addResourcesDirToRebelXml> 
    </configuration> 
    <executions> 
     <execution> 
      <id>generate-rebel-xml</id> 
      <phase>process-resources</phase> 
      <goals> 
       <goal>generate</goal> 
      </goals> 
     </execution> 
    </executions>    
</plugin> 

源:https://manuals.zeroturnaround.com/jrebel/standalone/advanced-config.html

+0

您也可以使用相對路徑 'target/classes'而不是'/ path_to_project_root/target/classes' – wiggin200 2017-09-09 21:47:20

5

確保該目錄列在rebel.xml與應用程序一起部署的配置文件中。如果用JRebel plugin for Maven生成你的rebel.xml,那麼只要確保你指定你想要的資源目錄被包含到配置:

<addResourcesDirToRebelXml>true</addResourcesDirToRebelXml> 

如果你使用IntelliJ IDEA的,你看不到應用於資源的更改,則可能沒有將IDE配置爲將資源目錄中的文件複製到目標目錄。或標記資源目錄「資源」目錄(右鍵單擊該文件夾在項目樹 - >標記目錄...)

+0

目錄被標記爲一個的IntelliJ資源目錄,但我不能確定它是否被複制到目標目錄。我怎樣才能做到這一點?我如何在jrebel配置中定義它? – momomo 2014-09-04 12:51:06

+0

在IntelliJ IDEA中,如果該目錄被標記爲Resources Root,則其所有內容將被自動複製到編譯器目標目錄。因此,如果您對任何資源進行了更改,則可以檢查目標文件夾中已更新的文件。或者,如果這看起來不起作用,您可以將該文件夾添加到rebel.xml配置文件中,以便JRebel可以監視該資源目錄。 – 2014-09-04 16:22:32

+0

反叛。XML,它是這應添加: <目錄名= 「/路徑/到/應用程序/ SRC /主/資源/」> momomo 2014-09-04 17:01:49

1

如果你正在使用IntelliJ IDEA的嘗試「做項目」,「生成」選項卡下或按Ctrl + F9。

+0

爲此,必須將編譯器配置設置爲將資源複製到目標文件夾,因爲在IDEA 13中引入了「資源」文件夾的概念並且所有資源都自動複製,所以現在無關。 – 2014-10-30 11:01:45

1

確保您的項目沒有eclipse中的任何編譯錯誤。

另請檢查您的JDK合規性。我有錯誤的版本,我的目標/類文件沒有更新。

如果不更新目標/類內容,JRebel的不需額外看到任何變化。