2015-02-20 6 views
7

मैं जीडब्ल्यूटी 2.7.0 के साथ मेवेन का उपयोग करने की कोशिश कर रहा हूं। क्या किसी के पास एक छोटा pom.xml टेम्पलेट है?क्या किसी के पास नमूना GWT 2.7.0 पोम है?

मैं विशेष रूप से स्वच्छ से देख रहा हूँ/स्थापित/चल (मैं इस्तेमाल किया gwt: पिछले परियोजना में रन) ...

उत्तर

7

क्या आप अपने पोम में की जरूरत है है:

एक न्यूनतम, सर्वर के लिए कभी नहीं तैनात पर
  • GWT निर्भरता (gwt-उपयोगकर्ता; GWT-RPC या अन्य सर्वर-साइड समर्थन, पहले से ही gwt-उपयोगकर्ता में शामिल कक्षाओं के लिए gwt-सर्वलेट; gwt -dev और gwt-codeerver की अनुशंसा की जाती है, यह उस प्लगइन पर निर्भर करता है जिसका आप उपयोग करेंगे, कभी भी उन्हें तैनात न करें)
  • gwt-maven-plugin; उनमें से दो हैं: org.codehaus.mojo:gwt-maven-plugin (जिसका संस्करण संस्करण GWT आप उपयोग कर रहे मेल खाना चाहिए), और net.ltgt.gwt.maven:gwt-maven-plugin (अभी भी बीटा में; GWT के किसी भी संस्करण के साथ काम करता)

प्लगइन के आधार पर आप का उपयोग करेंगे विभिन्न पैकेजिंग और प्लगइन विन्यास।

अंतिम, लेकिन कम से कम नहीं, आपको वास्तव में क्लाइंट और सर्वर साइड कोड के लिए अलग मैवेन मॉड्यूल का उपयोग करना चाहिए, साथ ही संभवतः साझा कोड के लिए एक तीसरा मॉड्यूल भी उपयोग करना चाहिए। एक छोटी परियोजना के लिए, हालांकि, एक मॉड्यूल का उपयोग करना पर्याप्त हो सकता है (लेकिन अगर आप अपने सर्वर पर अपने क्लाइंट-साइड क्लासेस को तैनात नहीं करना चाहते हैं तो आपको अपने पीओएम में कुछ कॉन्फ़िगरेशन/हैक जोड़ना होगा)।

हमें देता है यही कारण है, एक एकल मॉड्यूल परियोजना (मिश्रित ग्राहक और एक ही परियोजना में सर्वर-साइड कोड) के लिए, CodeHaus मोजो प्लगइन के साथ:

<?xml version="1.0" encoding="UTF-8"?> 
<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>com.example</groupId> 
    <artifactId>test</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <dependencyManagement> 
    <dependencies> 
     <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt</artifactId> 
     <version>2.7.0</version> 
     <type>pom</type> 
     <scope>import</scope> 
     </dependency> 
    </dependencies> 
    </dependencyManagement> 
    <dependencies> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-user</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-dev</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-codeserver</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-servlet</artifactId> 
     <scope>runtime</scope> 
    </dependency> 
    </dependencies> 

    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>gwt-maven-plugin</artifactId> 
     <version>2.7.0</version> 
     <executions> 
      <execution> 
      <goals> 
       <goal>compile</goal> 
      </goals> 
      </execution> 
     </executions> 
     <configuration> 
      <module>com.example.test.Test</module> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

और mvn gwt:run का उपयोग DevMode चलाने के लिए (जो कुछ सीमाओं के साथ, आपके सर्वर-साइड कोड भी चलाएगा)।

या net.ltgt प्लगइन के लिए:

<?xml version="1.0" encoding="UTF-8"?> 
<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>com.example</groupId> 
    <artifactId>test</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>gwt-app</packaging> 

    <dependencyManagement> 
    <dependencies> 
     <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt</artifactId> 
     <version>2.7.0</version> 
     <type>pom</type> 
     <scope>import</scope> 
     </dependency> 
    </dependencies> 
    </dependencyManagement> 
    <dependencies> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-user</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-dev</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-codeserver</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gwt</groupId> 
     <artifactId>gwt-servlet</artifactId> 
     <scope>runtime</scope> 
    </dependency> 
    </dependencies> 

    <build> 
    <plugins> 
     <plugin> 
     <groupId>net.ltgt.gwt.maven</groupId> 
     <artifactId>gwt-maven-plugin</artifactId> 
     <version>1.0-beta-1</version> 
     <extensions>true</extensions> 
     <configuration> 
      <moduleName>com.example.test.Test</moduleName> 
      <launcherDir>${project.build.directory}/${project.build.finalName}</launcherDir> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 

और SuperDevMode (क्लाइंट-साइड कोड केवल) को चलाने के लिए mvn gwt:codeserver का उपयोग करें। यद्यपि आपको अपने सर्वर-साइड कोड को चलाने के लिए जेटी-मेवेन-प्लगइन या tomcat7-maven-plugin का उपयोग करना होगा।


एक बहु मॉड्यूल परियोजना के लिए, मेरे आद्यरूप पर एक नजर है: https://github.com/tbroyer/gwt-maven-archetypes मैं उन्हें, net.ltgt प्लगइन की ओर पलायन को सरल बनाने आप उन्हें कैसे (कोई जरूरत mvn install को चलाएंगे करने की प्रक्रिया में हूँ अब, mvn gwt:codeserver बहु मॉड्यूल परियोजनाओं, CodeHaus मोजो के gwt:run के विपरीत और gwt:run-codeserver)

अस्वीकरण के लिए डिजाइन किया गया है: मैं दोनों प्लग-इन मेंटेनर हूँ, लेकिन मैं अपने ही प्लगइन है, जो IMO एक बहुत ठीक करता है के पक्ष में था कोडहॉस मोजो एक की quirks और गलतियों और विरासत की।

+0

धन्यवाद थॉमस, हालांकि, मैं थोड़ा के बारे में उलझन में हूँ: com.example.test.Test। क्या यह gwt.xml फ़ाइल के लिए "पथ" होना चाहिए? – jgp

+0

हां: बिंदीदार पैकेज का नाम + एक्सटेंशन के बिना फ़ाइल का नाम (नोट: यह ** ** एक फाइल सिस्टम पथ नहीं है!) –

1

https://github.com/ArcBees/arcbees-website/blob/master/pom.xml से लिया:

<?xml version="1.0" encoding="UTF-8"?> 
<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>com.arcbees</groupId> 
    <artifactId>website</artifactId> 
    <version>3.0-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <name>Arcbees Website</name> 

    <properties> 
     <target.jdk>1.7</target.jdk> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 

     <maven-surefire-plugin.version>2.6</maven-surefire-plugin.version> 
     <maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version> 
     <maven-gae-plugin.version>0.9.5</maven-gae-plugin.version> 
     <gwt-maven-plugin.version>2.7.0</gwt-maven-plugin.version> 
     <maven-clean-plugin.version>2.6.1</maven-clean-plugin.version> 

     <gwt.version>2.7.0</gwt.version> 
     <gae.version>1.9.9</gae.version> 
     <gwtp.version>1.5-SNAPSHOT</gwtp.version> 
     <guice.version>3.0</guice.version> 
     <gin.version>2.1.2</gin.version> 
     <gsss.version>1.0-SNAPSHOT</gsss.version> 
     <gwtquery.version>1.4.3-SNAPSHOT</gwtquery.version> 
     <gwt-maps-api.version>3.10.0-alpha-7</gwt-maps-api.version> 
     <tooltip.version>1.1</tooltip.version> 
     <appear.version>1.0-SNAPSHOT</appear.version> 
     <gwtchosen.version>2.0.0-SNAPSHOT</gwtchosen.version> 
     <guava.version>18.0</guava.version> 
     <universal-analytics.version>2.1</universal-analytics.version> 
     <velocity.version>1.7</velocity.version> 
     <gwt-seo.version>0.1-SNAPSHOT</gwt-seo.version> 

     <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> 
     <gae.home> 
      ${settings.localRepository}/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version} 
     </gae.home> 
    </properties> 

    <repositories> 
     <repository> 
      <id>sonatype.snapshots</id> 
      <name>Sonatype snapshot repository</name> 
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 

    <dependencies> 
     <!-- Google Web Toolkit dependencies --> 
     <dependency> 
      <groupId>com.google.gwt</groupId> 
      <artifactId>gwt-user</artifactId> 
      <version>${gwt.version}</version> 
      <scope>provided</scope> 
     </dependency> 

     <!-- GWT-Platform dependencies --> 
     <dependency> 
      <groupId>com.gwtplatform</groupId> 
      <artifactId>gwtp-mvp-client</artifactId> 
      <version>${gwtp.version}</version> 
      <scope>provided</scope> 
     </dependency> 

     <!-- DI dependencies --> 
     <dependency> 
      <groupId>com.google.gwt.inject</groupId> 
      <artifactId>gin</artifactId> 
      <version>${gin.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.google.inject</groupId> 
      <artifactId>guice</artifactId> 
      <version>${guice.version}</version> 
     </dependency> 

     <!-- Other --> 
     <dependency> 
      <groupId>com.arcbees.seo</groupId> 
      <artifactId>gwt-seo</artifactId> 
      <version>${gwt-seo.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.arcbees.gss</groupId> 
      <artifactId>gsss</artifactId> 
      <version>${gsss.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.googlecode.gwtquery</groupId> 
      <artifactId>gwtquery</artifactId> 
      <version>${gwtquery.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.gwtplatform</groupId> 
      <artifactId>gwtp-crawler</artifactId> 
      <version>${gwtp.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>com.github.branflake2267</groupId> 
      <artifactId>gwt-maps-api</artifactId> 
      <version>${gwt-maps-api.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.arcbees.gquery</groupId> 
      <artifactId>tooltip</artifactId> 
      <version>${tooltip.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.arcbees.gquery</groupId> 
      <artifactId>appear</artifactId> 
      <version>${appear.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.arcbees.analytics</groupId> 
      <artifactId>universal-analytics</artifactId> 
      <version>${universal-analytics.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.guava</groupId> 
      <artifactId>guava-gwt</artifactId> 
      <version>${guava.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.google.guava</groupId> 
      <artifactId>guava</artifactId> 
      <version>${guava.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.arcbees</groupId> 
      <artifactId>gwtchosen</artifactId> 
      <version>${gwtchosen.version}</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.velocity</groupId> 
      <artifactId>velocity</artifactId> 
      <version>${velocity.version}</version> 
     </dependency> 
    </dependencies> 

    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>com.google.gwt</groupId> 
       <artifactId>gwt-user</artifactId> 
       <version>${gwt.version}</version> 
       <scope>provided</scope> 
      </dependency> 
      <dependency> 
       <groupId>com.google.gwt</groupId> 
       <artifactId>gwt-dev</artifactId> 
       <version>${gwt.version}</version> 
       <scope>provided</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

    <build> 
     <!--suppress MavenModelInspection --> 
     <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory> 

     <plugins> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>gwt-maven-plugin</artifactId> 
       <version>${gwt-maven-plugin.version}</version> 

       <configuration> 
        <module>com.arcbees.website.Arcbees</module> 
        <testTimeOut>180</testTimeOut> 
        <includes>**/*GwtTest.java</includes> 
        <mode>htmlunit</mode> 

        <extraJvmArgs>-Xss1024K -Xmx1024M -XX:MaxPermSize=512M -Duser.language=en -Duser.country=US 
        </extraJvmArgs> 
        <logLevel>INFO</logLevel> 

        <copyWebapp>true</copyWebapp> 
        <hostedWebapp>${webappDirectory}</hostedWebapp> 

        <extraParam>true</extraParam> 
        <extra>extras</extra> 
        <optimizationLevel>9</optimizationLevel> 
        <deploy>${project.build.directory}/gwtDeploy</deploy> 
       </configuration> 
       <executions> 
        <execution> 
         <goals> 
          <goal>resources</goal> 
          <goal>compile</goal> 
          <goal>test</goal> 
         </goals> 
        </execution> 
       </executions> 

      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>${maven-compiler-plugin.version}</version> 
       <configuration> 
        <source>${target.jdk}</source> 
        <target>${target.jdk}</target> 
        <encoding>${project.build.sourceEncoding}</encoding> 
        <!-- Disable annotation processors during normal compilation --> 
        <proc>none</proc> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.4</version> 
       <executions> 
        <execution> 
         <phase>compile</phase> 
         <goals> 
          <goal>exploded</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <webappDirectory>${webappDirectory}</webappDirectory> 
        <webResources> 
         <resource> 
          <directory>src/main/webapp/WEB-INF</directory> 
          <filtering>true</filtering> 
          <includes> 
           <include>appengine-web.xml</include> 
          </includes> 
          <targetPath>WEB-INF</targetPath> 
         </resource> 
        </webResources> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>net.kindleit</groupId> 
       <artifactId>maven-gae-plugin</artifactId> 
       <version>${maven-gae-plugin.version}</version> 
       <dependencies> 
        <dependency> 
         <groupId>net.kindleit</groupId> 
         <artifactId>gae-runtime</artifactId> 
         <version>1.8.8</version> 
         <type>pom</type> 
        </dependency> 
       </dependencies> 
       <configuration> 
        <sdkDir>${gae.home}</sdkDir> 
        <serverId>appengine-credentials</serverId> 
        <splitJars>true</splitJars> 
       </configuration> 
       <executions> 
        <execution> 
         <id>install-server-jar</id> 
         <phase>validate</phase> 
         <goals> 
          <goal>unpack</goal> 
         </goals> 
        </execution> 
        <execution> 
         <id>deploy</id> 
         <goals> 
          <goal>deploy</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
    <profiles> 
     <profile> 
      <id>sdm</id> 
      <build> 
       <plugins> 
        <plugin> 
         <groupId>org.codehaus.mojo</groupId> 
         <artifactId>gwt-maven-plugin</artifactId> 
         <version>${gwt-maven-plugin.version}</version> 
         <configuration> 
          <module>com.arcbees.website.ArcbeesDev</module> 
         </configuration> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 

    <distributionManagement> 
     <repository> 
      <id>local-target</id> 
      <url>file://${project.build.directory}/distribution/release</url> 
     </repository> 
    </distributionManagement> 

</project> 
2

मूलरूप

के रूप में आप किसी भी अन्य Maven मूलरूप आदर्श एक टेम्पलेट/ठूंठ प्रोजेक्ट बनाने के लिए होगा इसका इस्तेमाल का उपयोग करना।

mvn archetype:generate \ 
    -DarchetypeGroupId=org.codehaus.mojo \ 
    -DarchetypeArtifactId=gwt-maven-plugin \ 
    -DarchetypeVersion=2.7.0 

डॉक्स: http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html

संबंधित मुद्दे