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

Maven Java Discussion :

[MAVEN] Precompilation de JSP


Sujet :

Maven Java

  1. #1
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut [MAVEN] Precompilation de JSP
    Existe-t-il un plugin permettant une precompilation de Jsp ?

  2. #2
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    Ok, j'ai trouver un petit plugin utilisant un compilateur d'Oracle

    Il ne me reste plus qu'a le tester

  3. #3
    Membre expérimenté

    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 172
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 172
    Points : 1 524
    Points
    1 524
    Par défaut
    le plugin à utiliser est le JSP Compiler : http://mojo.codehaus.org/jspc-maven-plugin/

  4. #4
    Membre expérimenté

    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 172
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 172
    Points : 1 524
    Points
    1 524
    Par défaut
    Exemple de conf:

    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
     
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jspc-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <warSourceDirectory>${project.build.directory}/${project.build.finalName}/</warSourceDirectory>
              <injectString><![CDATA[<!-- [jspc-maven-plugin:post-compiled-jsps-as-servlets] -->]]></injectString>
              <!-- 
                Uncomment outputWebXml if you want the generated web.xml to
                be placed in the working directory that the war:war mojo uses.
                -->
              <!-- 
              <outputWebXml>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</outputWebXml> 
              -->
            </configuration>
          </plugin>

  5. #5
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    Je viens effectivement d'utiliser ce plugin qui me semblait moins compliquer a mettre en oeuvre que celui que j'ai trouve.
    Maintenant en utilisant ta conf j'ai cette erreur :
    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
     
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] JSPC Error
     
    Embedded error: The -uriroot option must specify a pre-existing directory
    [INFO] ------------------------------------------------------------------------
    [DEBUG] Trace
    org.apache.maven.lifecycle.LifecycleExecutionException: JSPC Error
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
            at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
            at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
            at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    Caused by: org.apache.maven.plugin.MojoExecutionException: JSPC Error
            at org.codehaus.mojo.jspc.AbstractJspcMojo.execute(AbstractJspcMojo.java:265)
            at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
            ... 16 more
    Caused by: org.apache.jasper.JasperException: The -uriroot option must specify a pre-existing directory
            at org.apache.jasper.JspC.execute(JspC.java:1107)
            at org.codehaus.mojo.jspc.AbstractJspcMojo.execute(AbstractJspcMojo.java:248)
            ... 18 more
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5 seconds
    [INFO] Finished at: Fri Apr 06 12:40:17 CEST 2007
    [INFO] Final Memory: 5M/508M
    [INFO] ------------------------------------------------------------------------

  6. #6
    Membre expérimenté

    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 172
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 172
    Points : 1 524
    Points
    1 524
    Par défaut
    J'utilise la version 1.4.6 qui fonctionne correctement pour moi. Il me semble que ce n'est pas cette version que tu utilises.

    Lances maven en mode debug pour voir les arguments passés a jspc.

    Dans mon cas, je redefini le warSourceDirectory au lieu d'utiliser la valeur par défaut src/main/webapp car je fais quelques actions sur la webapp avant de faire la compil, peut-être que dans ton cas, tu peux utiliser le répertoire par défaut.

  7. #7
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    Voila les arguments passe :Voila les arguments passe :
    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
     
    [DEBUG] Output directory: C:\monProjet\WebContent\target/jsp-source
    [DEBUG] jspc args: [-uriroot, C:\monProjet\WebContent/src/main/webapp, -d, C:\WorkspaceOSIRIS\OsirisGenerique\WebContent\target/jsp-sou
    rce, -s, -l, -webinc, C:\monProjet\WebContent\target/web-fragment.xml, -p, jsp, -classpath, C:\monProjet\WebContent\target\classes;C:\D.....;]
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] JSPC Error
     
    Embedded error: The -uriroot option must specify a pre-existing directory
    [INFO] ------------------------------------------------------------------------
    [DEBUG] Trace
    org.apache.maven.lifecycle.LifecycleExecutionException: JSPC Error
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
    Alors effectivement j'ai moi aussi une arbo differente que celle de base :



    monProjet
    |-pom.xml ( parent )
    | JavaSource /
    | - pom.xml ( jar )
    | WebContent /
    | - pom.xml (war]

  8. #8
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    Apres modif du <warSourceDirectory> l'execution me sort une autre erreur :

    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
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] JSPC Error
     
    Embedded error: file:C:/monProjet/WebContent/generique/pages/consulterUtilisateur.jsp(26,0) file:C:/monProjet/WebContent/common/pages/includes/common.jsp(22,0) The absolute uri: http://titi.fr/referentiel cannot be resolved in either web.xml or the jar
    files deployed with this application
    [INFO] ------------------------------------------------------------------------
    [DEBUG] Trace
    org.apache.maven.lifecycle.LifecycleExecutionException: JSPC Error
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
            at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
            at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
            at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    Caused by: org.apache.maven.plugin.MojoExecutionException: JSPC Error
            at org.codehaus.mojo.jspc.AbstractJspcMojo.execute(AbstractJspcMojo.java:265)
            at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
            at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
            ... 16 more
    Caused by: org.apache.jasper.JasperException: file:C:/monProjet/WebContent/generique/pages/consulterUtilisateur.jsp(26,0) file:C:/monProjet/WebContent/common/pages/includes/common.jsp(22,0) The absolute uri: http://titi.fr/referentiel cannot be resolved
     in either web.xml or the jar files deployed with this application
            at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
            at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
            at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
            at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:339)
            at org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:372)
            at org.apache.jasper.compiler.Parser.parseXMLDirective(Parser.java:557)
            at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1554)
            at org.apache.jasper.compiler.Parser.parse(Parser.java:126)
            at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
            at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
            at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
            at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
            at org.apache.jasper.JspC.processFile(JspC.java:986)
            at org.apache.jasper.JspC.execute(JspC.java:1135)
            at org.codehaus.mojo.jspc.AbstractJspcMojo.execute(AbstractJspcMojo.java:248)
            ... 18 more
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 13 seconds
    [INFO] Finished at: Fri Apr 06 14:12:45 CEST 2007
    [INFO] Final Memory: 6M/508M
    [INFO] ------------------------------------------------------------------------

  9. #9
    Membre expérimenté

    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 172
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 172
    Points : 1 524
    Points
    1 524
    Par défaut
    -uriroot, C:\monProjet\WebContent/src/main/webapp
    The -uriroot option must specify a pre-existing directory

    Ta webapp n'est pas dans WebContent/src/main/webapp

    Quel est l'arborescence de ton projet WebContent?

  10. #10
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    je m'en suis appercu (mon post precedent )
    Mais toujours une erreur

  11. #11
    Membre expérimenté

    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 172
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 172
    Points : 1 524
    Points
    1 524
    Par défaut
    Citation Envoyé par DanielW33
    Embedded error: file:C:/monProjet/WebContent/generique/pages/consulterUtilisateur.jsp(26,0) file:C:/monProjet/WebContent/common/pages/includes/common.jsp(22,0) The absolute uri: http://titi.fr/referentiel cannot be resolved in either web.xml or the jar
    files deployed with this application
    Le message est clair

  12. #12
    Membre habitué Avatar de DanielW33
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    327
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Mai 2006
    Messages : 327
    Points : 164
    Points
    164
    Par défaut
    Effectivement le message etait clair.
    Maintenant j'ai une erreur car il ne trouve pas le web.xml (il le cheche toujours dans l'arbo de base maven i.e src/main/webapp alors que mon fichier se trouve dans ${basedir}/WEB-INF/web.xml )
    Quelle balise utilisé pour changer ce paramettre ???

  13. #13
    Membre expérimenté

    Profil pro
    Inscrit en
    Mai 2006
    Messages
    1 172
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Yvelines (Île de France)

    Informations forums :
    Inscription : Mai 2006
    Messages : 1 172
    Points : 1 524
    Points
    1 524
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <inputWebXml>${basedir}/WEB-INF/web.xml</inputWebXml>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [MAVEN][JPSC] Precompilation des pages jsp
    Par seddik_saber dans le forum Maven
    Réponses: 1
    Dernier message: 06/03/2013, 16h16
  2. [MAVEN][JPSC] Precompilation des pages jsp
    Par seddik_saber dans le forum Servlets/JSP
    Réponses: 1
    Dernier message: 06/03/2013, 15h56
  3. [Maven][Tomcat]librairie JSP-API pour la compilation
    Par totoranky dans le forum Maven
    Réponses: 2
    Dernier message: 01/04/2008, 14h27
  4. Précompiler des JSP avec Maven
    Par Frederik dans le forum Maven
    Réponses: 6
    Dernier message: 04/10/2007, 17h34
  5. [ ant ] précompilation jsp
    Par hocinema dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 01/06/2006, 10h54

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