IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GWT et Vaadin Java Discussion :

Projet Maven GWT


Sujet :

GWT et Vaadin Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    173
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 173
    Par défaut Projet Maven GWT
    Bonjour,

    J'essaye de contruire une application maven GWT (pour commencer); Mais je n'arrive pas à afficher le label sur l'IHM.

    La page HTML :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <link type="text/css" rel="stylesheet" href="GwtSpring.css">
        <title>GwtSpring</title>
        <script type="text/javascript" language="javascript" src="GwtSpring/GwtSpring.nocache.js"></script>
      </head>
      <body>
     
        <h1>GWT Spring</h1>
        <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
        <noscript>
          <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
            Your web browser must have JavaScript enabled
            in order for this application to display correctly.
          </div>
        </noscript>
        <center>
        <div id="Test1"/>
        <div id="Test2"/></center>
     
      </body>
    </html>
    La class Java : Entry point
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    package com.javacodegeeks.gwtspring.client;
     
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.RootPanel;
    import com.google.gwt.user.client.ui.VerticalPanel;
     
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class GwtSpring implements EntryPoint {
     
     
    	/**
             * 
             * This is the entry point method.
             */
     
    	public void onModuleLoad() {
     
    		System.out.println("coucou");
     
    		Label label = new Label("Test 1");
    		VerticalPanel vertical = new VerticalPanel();
    		vertical.add(label);
     
    		Label label2 = new Label("Test 2");
    		VerticalPanel vertical2 = new VerticalPanel();
    		vertical2.add(label2);
     
    		RootPanel.get("Test1").add(vertical);
    		RootPanel.get("Test2").add(vertical2);
    	}
     
     
    }
    Mon gwt.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    <?xml version="1.0" encoding="UTF-8"?>
    <module rename-to='GwtSpring'>
     
    	<inherits name='com.google.gwt.user.User' />
     
     
    	<inherits name='com.google.gwt.junit.JUnit' />
     
     
    	<inherits name='com.google.gwt.user.theme.standard.Standard' />
     
     
    	<entry-point class='com.javacodegeeks.gwtspring.client.GwtSpring' />
     
    	<set-property name="user.agent" value="ie8,safari,gecko1_8" />
     
    	<source path='client' />
    	<source path='shared' />
    	<source path='server' />
     
     
     
    </module>
    Sur la console de mon navigateur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/gwtspring/GwtSpring/GwtSpring.nocache.js
    Quelqu'un peut m'aider?

    Merci

  2. #2
    Membre habitué
    Profil pro
    Consultant BPM
    Inscrit en
    Janvier 2013
    Messages
    12
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Consultant BPM
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2013
    Messages : 12
    Par défaut
    Il faudrait que tu nous donnes ton pom.xml et ton fichier index pour que l'on puisse voir s'il ne s'agit pas d'une erreur dans ces derniers.

    Je ne sais pas si ça peut provoquer ton erreur mais
    RootPanel.get("Test1").add(vertical);
    me semble incorrect, je le remplacerais par
    RootPanel.get().add(vertical);

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    173
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 173
    Par défaut
    Le pom.xml :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    <?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/maven-v4_0_0.xsd">
     
    	<!-- POM file generated with GWT webAppCreator -->
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>com.javacodegeeks</groupId>
    	<artifactId>gwtspring</artifactId>
    	<packaging>war</packaging>
    	<version>0.0.1</version>
    	<name>GWT Maven Archetype</name>
     
    	<properties>
    		<!-- Convenience property to set the GWT version -->
    		<gwtVersion>2.4.0</gwtVersion>
     
    		<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    		<org.springframework.version>3.0.1.RELEASE</org.springframework.version>
    		<org.hibernate.version> 3.5.1-Final</org.hibernate.version>
    		<gwt.version>2.0.3</gwt.version>
    		<gwt-log.version>2.6.2</gwt-log.version>
    		<maven.compiler.source>1.6</maven.compiler.source>
    		<maven.compiler.target>1.6</maven.compiler.target>
    		<finalName>gwtspring</finalName>
    	</properties>
     
    	<dependencies>
    		<dependency>
    			<groupId>com.google.code.gwt-log</groupId>
    			<artifactId>gwt-log</artifactId>
    			<version>${gwt-log.version}</version>
    		</dependency>
     
    		<dependency>
    			<groupId>com.google.gwt</groupId>
    			<artifactId>gwt-servlet</artifactId>
    			<version>${gwtVersion}</version>
    			<scope>runtime</scope>
    		</dependency>
    		<dependency>
    			<groupId>com.google.gwt</groupId>
    			<artifactId>gwt-user</artifactId>
    			<version>${gwtVersion}</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>junit</groupId>
    			<artifactId>junit</artifactId>
    			<version>4.7</version>
    			<scope>test</scope>
    		</dependency>
    		<dependency>
    			<groupId>javax.validation</groupId>
    			<artifactId>validation-api</artifactId>
    			<version>1.0.0.GA</version>
    			<scope>test</scope>
    		</dependency>
    		<dependency>
    			<groupId>javax.validation</groupId>
    			<artifactId>validation-api</artifactId>
    			<version>1.0.0.GA</version>
    			<classifier>sources</classifier>
    			<scope>test</scope>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-orm</artifactId>
    			<version>${org.springframework.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-web</artifactId>
    			<version>${org.springframework.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-core</artifactId>
    			<version>${org.hibernate.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-annotations</artifactId>
    			<version>${org.hibernate.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-entitymanager</artifactId>
    			<version>${org.hibernate.version}</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate.javax.persistence</groupId>
    			<artifactId>hibernate-jpa-2.0-api</artifactId>
    			<version>1.0.0.Final</version>
    		</dependency>
    		<dependency>
    			<groupId>org.slf4j</groupId>
    			<artifactId>slf4j-log4j12</artifactId>
    			<version>1.5.8</version>
    		</dependency>
    		<dependency>
    			<groupId>org.hsqldb</groupId>
    			<artifactId>hsqldb</artifactId>
    			<version>1.8.0.10</version>
    		</dependency>
    		<dependency>
    			<groupId>c3p0</groupId>
    			<artifactId>c3p0</artifactId>
    			<version>0.9.1.2</version>
    		</dependency>
    		<dependency>
    			<groupId>javax.annotation</groupId>
    			<artifactId>jsr250-api</artifactId>
    			<version>1.0</version>
    		</dependency>
    	</dependencies>
     
    	<build>
    		<!-- Generate compiled stuff in the folder used for developing mode -->
    		<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
    		<finalName>${finalName}</finalName>
     
    		<plugins>
     
    			<!-- GWT Maven Plugin -->
    			<plugin>
    				<groupId>org.codehaus.mojo</groupId>
    				<artifactId>gwt-maven-plugin</artifactId>
    				<version>2.4.0</version>
    				<executions>
    					<execution>
    						<goals>
    							<goal>compile</goal>
    							<goal>test</goal>
    							<!-- <goal>i18n</goal> -->
    							<!-- <goal>generateAsync</goal> -->
    						</goals>
    					</execution>
    				</executions>
    				<!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
    					documentation at codehaus.org -->
    				<configuration>
    					<runTarget>GwtSpring.html</runTarget>
    					<hostedWebapp>${webappDirectory}</hostedWebapp>
    					<i18nMessagesBundle>com.javacodegeeks.gwtspring.client.Messages</i18nMessagesBundle>
    				</configuration>
    			</plugin>
     
    			<!-- Copy static web files before executing gwt:run -->
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-war-plugin</artifactId>
    				<version>2.1.1</version>
    				<executions>
    					<execution>
    						<phase>compile</phase>
    						<goals>
    							<goal>exploded</goal>
    						</goals>
    					</execution>
    				</executions>
    				<configuration>
    					<webappDirectory>${webappDirectory}</webappDirectory>
    				</configuration>
    			</plugin>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<version>2.3.2</version>
    				<configuration>
    					<source>1.5</source>
    					<target>1.5</target>
    				</configuration>
    			</plugin>
     
    			<plugin>
    				<groupId>org.codehaus.mojo</groupId>
    				<artifactId>tomcat7-maven-plugin</artifactId>
    				<version>2.0-SNAPSHOT</version>
    				<configuration>
    					<url>http://localhost:8080/manager/html</url>
    					<server>myserver</server>
    					<path>/</path>
    				</configuration>
    			</plugin>
     
    		</plugins>
     
     
     
    	</build>
     
     
     
     
    </project>
    Par contre pour le RootPanel.get("Test1") permets de placer dans le panel dans <div id = "Test1"/>. J'ai déjà essayé RootPanel.get(), mais ca ne marche pas mieux

    Sinon, le html joint précédement GwtSpring.html est mon index.html. En changeant le nom du html; j'ai une erreur 404.

  4. #4
    Membre éclairé
    Inscrit en
    Février 2009
    Messages
    70
    Détails du profil
    Informations forums :
    Inscription : Février 2009
    Messages : 70
    Par défaut
    - Après ton maven install et ton déploiement sur ton serveur, est ce que ton fichier "GwtSpring.nocache.js" est bien créé sur ton serveur et à la bonne position ("GwtSpring/GwtSpring.nocache.js" par rapport à ton fichier HTML) ?
    - Tu utilise quoi (IDE et serveur) pour lancer le tout ?

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    173
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 173
    Par défaut Probleme le probde déploiement?
    Bonjour;

    Je me rends compte qu'il s'agit d'un probleme de déploiement et qu'il manquerai qq chose dans ma config maven (pom.xml)

    Car, si je compile un war, que je dépose manuellement dans le webapp de Tomcat et que je redemarre, l'appli fonction, par contre, avec tomcat:deploy ou tomcat:run, la partie GWT ne marche pas

    Des idées?

  6. #6
    Membre éclairé
    Inscrit en
    Février 2009
    Messages
    70
    Détails du profil
    Informations forums :
    Inscription : Février 2009
    Messages : 70
    Par défaut
    Si tu déploie via éclipse, sur ton serveur, celui ci ne prend pas ton war construit par maven, mais il a son propre build (sans gwt).

    Moi, ce que je ferais, afin que eclipse prenne en compte ton gwt dans son déployement, il faut faire une maven package à "chaud", en mettant tes sources gwt dans ton dossier src/main/webapp ...

Discussions similaires

  1. Plugin Maven GWT : vos avis
    Par hugo123 dans le forum GWT et Vaadin
    Réponses: 16
    Dernier message: 04/12/2012, 06h16
  2. Réponses: 2
    Dernier message: 16/01/2009, 18h11
  3. Création d'un war d'un projet maven de type webapp
    Par thierry_b dans le forum Maven
    Réponses: 1
    Dernier message: 14/01/2009, 17h56
  4. Réponses: 1
    Dernier message: 24/02/2008, 22h09
  5. [Continuum] Probleme mise en integration continue d'un projet maven
    Par Pandah dans le forum Intégration Continue
    Réponses: 7
    Dernier message: 21/06/2007, 15h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo