1 pièce(s) jointe(s)
utiliser == distributionManagement element
bonjour,*
Je developpe une application Web Java EE sous Fedora 27, je me sers actuellement que de maven comme outil de build.
L'application est une gestion de ticket d'incidents, j'apprends plutot a packager et deployer des WAR dans tomcat 8.5.
Voici l'achitecture sur laquelle je travail :
Pièce jointe 375399
Le pom.xml parent est parametré comme ceci :
Code:
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
| <?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>org.exemple.demo</groupId>
<artifactId>ticket</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>ticket-batch</module>
<module>ticket-business</module>
<module>ticket-consumer</module>
<module>ticket-model</module>
<module>ticket-webapp</module>
</modules>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket-batch</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket-business</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket-consumer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.exemple.demo</groupId>
<artifactId>ticket-webapp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.11.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project> |
le pom.xml de ma webapp est comme ceci :
Code:
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
| <?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>
<parent>
<artifactId>ticket</artifactId>
<groupId>org.exemple.demo</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>ticket-webapp</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ticket-business</artifactId>
</dependency>
<!-- ===== Bibliothèques tierces ===== -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.1</version>
<exclusions>
<!-- La dépendance vers commons-lang3 est exclue -->
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<!-- =============================================================== -->
<!-- Profils -->
<!-- =============================================================== -->
<profiles>
<!-- Profil pour l'environnement de développement -->
<profile>
<id>target-dev</id>
</profile>
<!-- Profil pour l'environnement de test -->
<profile>
<id>target-test</id>
</profile>
<!-- Profil pour l'environnement de production -->
<profile>
<id>target-prod</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-target-prod-no-snaphsot</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<!-- Le projet et son parent ne doivent pas être en SNAPSHOT -->
<requireReleaseVersion />
<!-- Aucune dépendance ne doit être en SNAPSHOT -->
<requireReleaseDeps />
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>MyCo Internal Repository</name>
<url>Host to Company Repository</url>
</repository>
</distributionManagement>
<!-- =============================================================== -->
<!-- Build -->
<!-- =============================================================== -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>org.exemple.demo.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<!-- je choisis un nom unique pour définir cette exécution -->
<id>enforce-profile-target</id>
<!-- je branche l'exécution à la phase "validate" -->
<phase>validate</phase>
<!-- cette exécution lancera le goal "enforce" -->
<goals>
<goal>enforce</goal>
</goals>
<!-- La configuration du plugin propre à cette exécution -->
<configuration>
<rules>
<requireActiveProfile>
<profiles>target-dev,target-test,target-prod</profiles>
<all>false</all>
</requireActiveProfile>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>jsp/_include/header.jsp</include>
<include>jsp/_include/footer.jsp</include>
<include>jsp/about.jsp</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<!-- =============================================================== -->
<!-- Propriétés -->
<!-- =============================================================== -->
<properties>
<!-- Le nom "public" de l'application -->
<application.name>TicketTac</application.name>
<!-- Le format à utiliser pour afficher la date du build -->
<maven.build.timestamp.format>dd/MM/yyyy</maven.build.timestamp.format>
<!-- Propriété servant à contourner le bug du non remplacement
de la propriété maven.build.timestamp lors du filtrage des ressources -->
<buildTimestamp>${maven.build.timestamp}</buildTimestamp>
</properties>
</project> |
je voudrais déployer ma solution dans un war mais eclipse oxygen 3 me retourne l'erreur suivante :
Citation:
INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project ticket: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
[ER
je ne sais pas comment utiliser distributionManagement pour générer mon war pour l'herberger dans tomcat !
mon bloc
Code:
1 2 3 4 5 6 7
| <distributionManagement>
<repository>
<id>internal.repo</id>
<name>MyCo Internal Repository</name>
<url>Host to Company Repository</url>
</repository>
</distributionManagement> |
je ne sais pas si il faut le déclarer dans le pom parent ou dans le pom de ma webapp.
pour le moment je l'ai mis dans le pom de ma webapp.
Je travail pour le moment sans framework comme spring , j'apprends simplement a packager mon application.
ma question est comment puis-je générer un WAR dans tomcat ?
Salutations
philippe