2016-12-29 1 views
0

Je voulais essayer Spring-MVC avec GWT et pour cela j'ai trouvé this archétype. Lorsque je l'ai téléchargé localement et que j'ai exécuté un mvn clean && mvn install, il génère un fichier jar, mais l'empaquetage du projet dans le second pom.xml est de type WAR. Pour le déployer dans tomcat, j'ai ajouté la sortie de compilation pour le projet, mais je suis toujours incapable d'exécuter le projet. J'ajoute le journal des erreurs et les captures d'écran. Quelqu'un peut-il m'aider à comprendre la structure du projet? Je vous remercie.Spring, Maven: Impossible de déployer le module avec tomcat

Désolé pour le TMI, je ne sais pas exactement quel est le problème, donc essayer toutes les possibilités.

Erreur journal:

Connected to server 
[2016-12-29 01:52:13,364] Artifact unnamed: Artifact is being deployed, please wait... 
[2016-12-29 01:52:13,388] Artifact unnamed: Error during artifact deployment. See server log for details. 
[2016-12-29 01:52:13,389] Artifact unnamed: com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: /home/akshay/gwt/spring-mvc-quickstart-archetype/out/artifacts/unnamed not found for the web module. 
Dec 29, 2016 1:52:23 PM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory /home/akshay/Downloads/apache-tomcat-7.0.69/webapps/examples 

extérieur pom.xml:

<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"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>pl.codeleak</groupId> 
    <artifactId>spring-mvc-quickstart</artifactId> 
    <version>1.0.0</version> 
    <packaging>maven-archetype</packaging> 
    <name>Spring MVC Maven Archetype: Quickstart</name> 
    <description>Archetype for creating Spring MVC 4 web application</description> 
    <url>https://github.com/kolorobot/spring-mvc-quickstart-archetype</url> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <build> 
     <extensions> 
      <extension> 
       <groupId>org.apache.maven.archetype</groupId> 
       <artifactId>archetype-packaging</artifactId> 

       <version>2.2</version> 
      </extension> 
     </extensions> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-archetype-plugin</artifactId> 
        <version>2.2</version> 

       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-resources-plugin</artifactId> 
        <version>2.6</version> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
    </build> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>apache.snapshots</id> 
      <name>Apache Snapshots</name> 
      <url>http://repository.apache.org/content/groups/snapshots-group/</url> 
      <releases> 
       <enabled>false</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </pluginRepository> 
    </pluginRepositories> 
</project> 

pom.xml intérieur:

<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" 
> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>${groupId}</groupId> 
    <artifactId>${artifactId}</artifactId> 
    <packaging>war</packaging> 
    <version>${version}</version> 
    <name>Spring MVC Application</name> 
    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <java-version>1.8</java-version> 
     <!-- Override Spring version --> 
     <!-- spring.version>4.3.3.RELEASE</spring.version --> 
     <!-- Thymeleaf 3 --> 
     <org.thymeleaf-version>3.0.2.RELEASE</org.thymeleaf-version> 
     <org.thymeleaf.extras.springsecurity4-version>3.0.0.RELEASE</org.thymeleaf.extras.springsecurity4-version> 
     <nz.net.ultraq.thymeleaflayout-version>2.0.5</nz.net.ultraq.thymeleaflayout-version> 
     <thymeleaf-extras-java8time-version>3.0.0.RELEASE</thymeleaf-extras-java8time-version> 
     <!-- AssertJ is not a part of Spring IO platform, so the version must be provided explicitly --> 
     <assertj-core-version>3.5.2</assertj-core-version> 
    </properties> 
    <parent> 
     <groupId>io.spring.platform</groupId> 
     <artifactId>platform-bom</artifactId> 
     <version>Athens-SR1</version> 
     <relativePath/> 
    </parent> 
// And subsequent dependencies 

<plugins> 
      <plugin> 
       <groupId>org.apache.tomcat.maven</groupId> 
       <artifactId>tomcat7-maven-plugin</artifactId> 
       <version>2.2</version> 
       <configuration> 
        <path>/</path> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>${java-version}</source> 
        <target>${java-version}</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.1.1</version> 
       <configuration> 
        <warName>${artifactId}-${version}</warName> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <executions> 
        <execution> 
         <id>deploy</id> 
         <phase>deploy</phase> 
         <goals> 
          <goal>sources</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-resources-plugin</artifactId> 
       <version>2.6</version> 
       <configuration> 
        <encoding>${project.build.sourceEncoding}</encoding> 
       </configuration> 
      </plugin> 
     </plugins> 

Captures d'écran:

enter image description here

enter image description here

enter image description here

Répondre

2

Ce n'est pas comment vous utilisez un archétype: vous devez exécuter mvn archetype:generate et cela va générer un projet pour vous (basé sur le POM "interne"). Vous n'avez même pas besoin de cloner et de construire le projet archétype lui-même. En fait, la commande exacte est donnée dans le fichier README: https://github.com/kolorobot/spring-mvc-quickstart-archetype/#create-a-project

+0

Ce que vous avez dit a fonctionné, pouvez-vous juste me dire comment je peux exécuter ce projet depuis Intellij ide et générer un fichier war pour le déploiement. Je vous remercie. –

+0

cela a fonctionné, merci beaucoup .. :-) –

-1

Pour autant que je compris la question. essayez d'ajouter plugin guerre Maven Maven archétype pom vous voulez essayer

<plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.1.1</version> 
      <configuration> 
       <warName>${artifactId}-${version}</warName> 
      </configuration> 
     </plugin> 

et mettre le

<packaging>war</packaging> 

dans votre nouvel en-tête de pom. Vous pouvez également mettre dans la version d'en-tête et l'ID d'artefact, ainsi le plugin de guerre de maven pourrait les résoudre et remplir la balise warName