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 :

Précompiler des JSP avec Maven


Sujet :

Maven Java

Vue hybride

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

    Informations forums :
    Inscription : Mars 2003
    Messages : 98
    Par défaut Précompiler des JSP avec Maven
    Bonjour à toutes et à tous...

    Actuellement je suis en train d'essayer de précompiler des JSP (je me sers de JBoss 4.0.4)...

    Comment puis-je faire celà par Maven???


    Merci d'avance

    Fred

  2. #2
    Rédacteur
    Avatar de romaintaz
    Homme Profil pro
    Java craftsman
    Inscrit en
    Juillet 2005
    Messages
    3 790
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Java craftsman
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2005
    Messages : 3 790
    Par défaut
    Hello,

    Je te conseille d'aller jeter un oeil sur le plugin JSPC, qui devrait répondre à tes besoins...
    Nous sommes tous semblables, alors acceptons nos différences !
    --------------------------------------------------------------
    Liens : Blog | Page DVP | Twitter
    Articles : Hudson | Sonar | Outils de builds Java Maven 3 | Play! 1 | TeamCity| CitConf 2009
    Critiques : Apache Maven

  3. #3
    Membre chevronné

    Inscrit en
    Septembre 2006
    Messages
    466
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 466
    Par défaut
    Pour information, il y a eu récemment des discussions sur les outils Javascript avec maven 2.

    Plugins :
    * mvn-jstools qui vient juste de sortir en v0.1 ;
    * maven-js-plugin en v1.2.

    Deux pages wiki ont été proposées pour relater les initiatives actuelles autour de JavaScript et Maven 2 :
    * maven-javascript-tools ;
    * maven-javascript-plugin: Work in Progress.

    Rémy

  4. #4
    Membre éclairé 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
    Par défaut
    Merci pour ces infos rseM2
    Mais ces plugins n'ont rien a voir avec le plugin JSPC de precompilation de JSP (Java Server Pages).

  5. #5
    Membre chevronné

    Inscrit en
    Septembre 2006
    Messages
    466
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 466
    Par défaut
    Citation Envoyé par DanielW33 Voir le message
    Merci pour ces infos rseM2
    Mais ces plugins n'ont rien a voir avec le plugin JSPC de precompilation de JSP (Java Server Pages).
    Oui effectivement.
    Désolé j'ai lu un peu trop vite et n'avait pas beaucoup de temps pour répondre...

    Rémy

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2003
    Messages
    98
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2003
    Messages : 98
    Par défaut
    Re-bonjour...


    J'essaye de compiler des pages JSP...

    Pour celà je génère un *.war issu de plusieurs autres projets rassemblés entre eux. J'ai donc créer un projet nommé Deploiement_war qui contient le pom.xml chargé de faire le packaging war.


    afin que que le plugin jspc prenne en considération les fichiers *.jsp, j'ai copié ces derniers dans le répertoire

    src/main/WebApp/WEB-INF/body

    et j'y ai également rajouté

    src/main/WebApp/WEB-INF/tlds

    plus le fichier src/main/WebApp/WEB-INF/web.xml



    Le fichier pom.xml est indiqué ci-dessous:

    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
    197
    198
    199
    200
    201
    202
     
     
     
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project>
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>test.mco.ihm</groupId>
    	<artifactId>WebApp</artifactId>
    	<packaging>war</packaging>
    	<name>WebApp</name>
    	<version>1.0-SNAPSHOT</version>
    	<description>Generation WAR</description>
    	<build>
    		<sourceDirectory>.</sourceDirectory>
    		<plugins>
     
    			<plugin>
    				<groupId>org.codehaus.mojo</groupId>
    				<artifactId>jspc-maven-plugin</artifactId>
    				<version>1.4.6</version>
     
    				<executions>
    					<execution>
    						<id>jspc</id>
    						<goals>
    							<goal>compile</goal>
    						</goals>
    					</execution>
    				</executions>
    				<configuration>
    				<source>1.5</source>
    				<target>1.5</target>
    					<inputWebXml>
    						src/main/WebApp/WEB-INF/web.xml
    					</inputWebXml>
    					<packageName>testJSPCompilees</packageName>
    					<setCompile>true</setCompile>
    					<showSuccess>true</showSuccess>
    					<verbose>true</verbose>
    					<listErrors>true</listErrors>
    				</configuration>
    			</plugin>
     
     
     
    			<plugin>
    				<artifactId>maven-war-plugin</artifactId>
    				<version>2.0.2</version>
    				<configuration>
    					<warSourceDirectory>
    						src/main/WebApp
    					</warSourceDirectory>
    					<webXml>${basedir}/target/jspweb.xml</webXml>
     
     
    					<!--<webXml>src/main/WebApp/WEB-INF/web.xml</webXml>
    					-->
    					<webResources>
     
    						<resource>
    							<directory>src/main/WebApp</directory>
    							<targetPath>.</targetPath>
    							<excludes>
    								<exclude>*.*</exclude>
    								<exclude>**/**/*.*</exclude>
                                                                    <exclude>**/*.xml</exclude>
    							</excludes>
    						</resource>
    						<!--<resource>
    							<directory>src/main</directory>
    							<targetPath>.</targetPath>
    							<includes>
    							<include>*.*</include>
    							</includes>
    							</resource>
    						-->
    						<resource>
    							<directory>
    								../Socle_IHM/src/main/WebApp/styles
    							</directory>
    							<targetPath>styles</targetPath>
    							<includes>
    								<include>*.*</include>
    							</includes>
    						</resource>
    						<resource>
    							<directory>
    								../Socle_IHM/src/main/WebApp/scripts
    							</directory>
    							<targetPath>scripts</targetPath>
    							<includes>
    								<include>**/*.*</include>
    							</includes>
    						</resource>
    						<resource>
    							<directory>
    								../Socle_IHM/src/main/WebApp/images
    							</directory>
    							<targetPath>images</targetPath>
    							<includes>
    								<include>**/*.*</include>
    							</includes>
    						</resource>
    						<resource>
    							<directory>
    								../Socle_IHM/src/main/WebApp/dtd
    							</directory>
    							<targetPath>dtd</targetPath>
    							<includes>
    								<include>**/*.*</include>
    							</includes>
    						</resource>
    						<resource>
    							<directory>
    								../Socle_IHM/src/main/WebApp/WEB-INF
    							</directory>
    							<targetPath>WEB-INF</targetPath>
    							<excludes>
    								<exclude>web.xml</exclude>
    							</excludes>
    							<includes>
    								<include>**/*.*</include>
    							</includes>
    						</resource><!--
    						<resource>
    							<directory>
    								../Socle_IHM/src/main/WebApp/jsp
    							</directory>
    							<targetPath>body</targetPath>
    							<includes>
    								<include>**/*.*</include>
    							</includes>
    						</resource>
    						--><resource>
    							<directory>
    								../Test01_IHM/src/main/WebApp/WEB-INF/
    							</directory>
    							<targetPath>WEB-INF</targetPath>
    							<excludes>
    								<exclude>web.xml</exclude>
    							</excludes>
    							<includes>
    								<include>*.xml</include>
    							</includes>
    						</resource><!--
    						<resource>
    							<directory>
    								../Test01_IHM/src/main/WebApp/WEB-INF/body
    							</directory>
    							<targetPath>body</targetPath>
    							<includes>
    								<include>*.jsp</include>
    							</includes>
    						</resource>
    						--><resource>
    							<directory>
    								../Test02_IHM/src/main/WebApp/WEB-INF/
    							</directory>
    							<targetPath>WEB-INF</targetPath>
    							<excludes>
    								<exclude>web.xml</exclude>
    							</excludes>
    							<includes>
    								<include>*.xml</include>
    							</includes>
    						</resource><!--
    						<resource>
    							<directory>
    								../Test02_IHM/src/main/WebApp/WEB-INF/body
    							</directory>
    							<targetPath>body</targetPath>
    							<includes>
    								<include>*.jsp</include>
    							</includes>
    						</resource>
    						--><resource>
    							<directory>
    								../Integration/src/main/WebApp/WEB-INF
    							</directory>
    							<targetPath>WEB-INF</targetPath>
    							<excludes>
    								<exclude>web.xml</exclude>
    							</excludes>
    							<includes>
    								<include>**/*.*</include>
    							</includes>
    						</resource>
     
     
    					</webResources>
    				</configuration>
    			</plugin>
     
    		</plugins>
    	</build>
     
    <dependencies>
    		<dependency>
    ...
    		</dependency>
    	</dependencies>
    </project>

    Après la commande mvn clean install

    Le dit fichier web.xml est bien copié puis modifié par le module jspc qui a rajouté à la fin du fichier :

    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
     
     
    <!--
    Automatically created by Apache Jakarta Tomcat JspC.
    Place this fragment in the web.xml before all icon, display-name,
    description, distributable, and context-param elements.
    -->
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.barre_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.barre_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.entete_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.entete_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.frameset_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.frameset_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.index_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.index_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.principal_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.principal_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Test_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.Test_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Test02_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.Test02_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testArborescence_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.testArborescence_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testArborescence2_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.testArborescence2_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.testPlanning_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning2_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.testPlanning2_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning3_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.testPlanning3_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning4_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.testPlanning4_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning5_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.testPlanning5_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.TestTableau_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.TestTableau_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Tile0_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.Tile0_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Tile1_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.Tile1_jsp</servlet-class>
        </servlet>
     
        <servlet>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Vide_jsp</servlet-name>
            <servlet-class>testJSPCompilees.WEB_002dINF.body.Vide_jsp</servlet-class>
        </servlet>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.barre_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/barre.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.entete_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/entete.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.frameset_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/frameset.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.index_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/index.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.principal_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/principal.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Test_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/Test.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Test02_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/Test02.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testArborescence_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/testArborescence.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testArborescence2_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/testArborescence2.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/testPlanning.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning2_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/testPlanning2.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning3_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/testPlanning3.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning4_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/testPlanning4.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.testPlanning5_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/testPlanning5.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.TestTableau_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/TestTableau.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Tile0_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/Tile0.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Tile1_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/Tile1.jsp</url-pattern>
        </servlet-mapping>
     
        <servlet-mapping>
            <servlet-name>testJSPCompilees.WEB_002dINF.body.Vide_jsp</servlet-name>
            <url-pattern>/WEB-INF/body/Vide.jsp</url-pattern>
        </servlet-mapping>
     
    <!--
    All session-config, mime-mapping, welcome-file-list, error-page, taglib,
    resource-ref, security-constraint, login-config, security-role,
    env-entry, and ejb-ref elements should follow this fragment.
    -->

    j'ai donc l'arborescence suivante dans le répertoire target/:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
     target/ --classes/
    	 --jsp-source/
    	 --WebApp-1.0-SNAPSHOT/
    		--dtd/
    		...
    			WEB-INF/
    			 	--body/
    				--classes/
    				--lib/
    				--tlds/
    				web.xml
    Malheureusement je ne peux pas accéder aux pages JSP (compilées) en passant par l'adresse

    http://127.0.0.1:8080/WebApp-1.0-SNA...body/index.jsp (comme les url-pattern le laissent supposer)

    D'où vient mon problème???

    merci d'avance.

    PS : Si une version compilée des *.jsp existe dans l'archive, alors les fichier suffixés par *.jsp sont-il toujours nécessaire au sein de cette archive?

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

Discussions similaires

  1. précompilation des jsp avec tomcat 6
    Par osman.amine dans le forum Tomcat et TomEE
    Réponses: 0
    Dernier message: 05/11/2008, 20h33
  2. Compilation des jsp - jspc-maven-plugin
    Par RémyYves dans le forum Maven
    Réponses: 1
    Dernier message: 21/07/2008, 17h29
  3. Probleme d'appel des jsp(avec balise struts) par ajax
    Par edogawa dans le forum Struts 1
    Réponses: 1
    Dernier message: 23/08/2007, 23h14
  4. la couverture des tests avec maven
    Par adilo dans le forum Qualimétrie
    Réponses: 4
    Dernier message: 26/07/2006, 08h41
  5. [WSAD]Précompilation des jsps
    Par dune21 dans le forum Servlets/JSP
    Réponses: 6
    Dernier message: 06/12/2005, 11h09

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