簡體   English   中英

如何在gwt-maven項目中部署

[英]How to deploy in a gwt-maven project

首先,我不確定我必須在gwt-maven項目中部署哪些文件夾和文件:.gwt .settings bin src / main / java target war pom.xml

我很確定,我必須以某種方式部署pom.xml和目標文件夾。 但是我的目標文件夾不包含pom.xml,我需要將其部署在碼頭服務器上

其次:我已經在Web服務器上安裝了maven,但是除了將jetty-maven-plugin嵌入pom.xml中(通過org.eclipse.jetty jetty-maven-plugin)之外,我完全不知道如何運行該項目。在碼頭服務器上。

http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0 SiedlerVonCatanC SiedlerVonCatanC war src / main / java src / main / java * / .java maven-compiler-plugin 3.1 1.7 1.7

        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.5.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <module>main.java.de.swp.catan.SiedlerVonCatanC</module>
                        <runTarget>SiedlerVonCatanC.html</runTarget>
                        <hostedWebapp>${webappDirectory}</hostedWebapp>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
<dependencies>
    <!-- GWT -->
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-servlet</artifactId>
        <version>2.5.1</version>
    </dependency>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>2.5.1</version>
    </dependency>
    <!-- SmartGWT -->
    <dependency>
        <groupId>com.smartgwt</groupId>
        <artifactId>smartgwt</artifactId>
        <version>3.0</version>
    </dependency>
    <!-- Event Service -->
    <dependency>
        <groupId>de.novanic.gwteventservice</groupId>
        <artifactId>gwteventservice</artifactId>
        <version>1.2.0</version>
    </dependency>

    <!-- Java-Mail -->
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>

    <!-- Apache Commons -->
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.3</version>
    </dependency>

    <!-- htmlunit (wird im Projekt irgendwo genutzt) -->
    <!-- <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> 
        <version>2.4</version> </dependency> -->

    <!-- Guice -->
    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>3.0</version>
    </dependency>

    <!-- Connector for JDBC -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.25</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>com.smartgwt</id>
        <url>http://www.smartclient.com/maven2</url>
    </repository>
</repositories>
<version>0.2</version>

在插件下的pom中包含maven-jetty-plugin,然后您可以將其運行為

     mvn jetty:run

謝謝

如果要使用maven插件運行嵌入式Jetty進行開發,則使用命令行(我建議開始使用)的簡單方法是:

編輯:請注意,這與現有項目無關,它是從頭開始的過程。 只需在要創建新gwt項目的新目錄中運行這些命令。

  • 下載gwt maven插件http://mojo.codehaus.org/gwt-maven-plugin/ 在命令行列表中,您可以將其視為org.codehaus.mojo:gwt-maven-plugin (Maven plugin for the Google Web Toolkit.)我看到您在POM中擁有此插件,但是如果您不知所措,請執行以下簡單步驟從命令行到實現這是:

    1. mvn archetype:generate
    2. 在搜索提示中輸入org.codehaus.mojo:gwt-maven-plugin
    3. 用enter確認結果
    4. 根據提示設置Maven項目配置
  • 使用mvn gwt:runmvn gwt:run pom.xml的文件夾運行項目

這兩個步驟將為您運行一個示例項目,您可以在了解其工作原理的同時進行進一步的修改和試驗。

至於目錄:maven將所有內容編譯到目標目錄中,用於部署或運行​​嵌入式碼頭。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM