Ich habe einige Probleme während der Bereitstellung der Anwendung im Frühjahr Boot. Ich habe folgende Bewerbungsstruktur. Es gibt insgesamt drei Projekte. Erstes Projekt ist Projekt Parent und seine Paketart ist Krieg Zweites Projekt ist simple-weather und sein Pakettyp ist pom (Ich werde in Zukunft noch einige maven-Module hinzufügen) Drittes Projekt ist simple-webapp und dessen Pakettyp ist pom (ich werde ein paar mehr maven Module in Zukunft hinzufügen)Probleme in aggregierten pom
Sowohl einfache Wetter und einfach Webapp hinzugefügt als Abhängigkeit in Mutter pom
Hier Code
Parent Project 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ProjectParent</groupId>
<artifactId>projectparent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<modules>
<module>simple-webapp</module>
<module>simple-weather</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.5.RELEASE</version>
</parent>
<!-- Additional lines to be added here... -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
einfach weather.pom
<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>
<groupId>ProjectParent</groupId>
<artifactId>projectparent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>simple-weather</artifactId>
<properties>
<!-- The main class to start by executing java -jar -->
<start-class>HelloWorldApplication1</start-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<packaging>pom</packaging>
</project>
einfach webapp.pom
<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>
<groupId>ProjectParent</groupId>
<artifactId>projectparent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>simple-webapp</artifactId>
<packaging>pom</packaging>
<properties>
<!-- The main class to start by executing java -jar -->
<start-class>HelloWorldApplication</start-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Das Problem ist also, wenn ich versuche Mutter pom zu implementieren Tomcat, heißt es folgende Nachricht
[FEHLER] Das Projekt ProjectParent: projectparent: 0.0.1-SNAPSHOT (E: \ Dashboard \ Arbeitsbereich \ projectparent \ pom.xml) hat 1 Fehler [FEHLER]
'Verpackung' mit Wert 'War' ist ungültig. Aggregator-Projekte benötigen "Pom" als Verpackung. @ Zeile 6, Spalte 14
Irgendwelche Vorschläge?
Ich kann nicht das Paket von Simple-Webapp wechseln, weil ich Submodule in diesem Projekt hinzufügen werde. Wenn ich es in Krieg ändere, dann kann ich keine Untermodule hinzufügen. – user3257435
Entweder ist es ein Krieg oder es ist ein Elternteil. Weitere Module gehören zum Elternpom und nicht zum Kriegsmodul. – Kai
@ user3257435 Warum würden Sie Submodule zu einem Projekt hinzufügen, das wirklich ein WAR ist? das ergibt für mich keinen Sinn. – eis