java - spring-boot without parent pom.xml cannot generate war packaging -
i used example gs-convert-jar-to-war provided spring-io. describes how generate war packaging within spring boot project.
the spring-boot documentation allows using own parent poms, omitting predefined parent pom spring-boot projects. following dependency has added:
<dependencymanagement> <dependencies> <dependency> <!-- import dependency management spring boot --> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.0.1.release</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencymanagement> i applied change (and change) example. afterwards no longer possible generate war. following error message:
[error] failed execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project gs-convert-jar-to-war: error assembling war: webxml attribute required (or pre-existing web-inf/web.xml if executing in update mode) -> [help 1] here complete listing of modified pom.xml:
<?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.springframework-sample</groupid> <artifactid>gs-convert-jar-to-war</artifactid> <version>0.1.0</version> <packaging>war</packaging> <dependencymanagement> <dependencies> <dependency> <!-- import dependency management spring boot --> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.0.1.release</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencymanagement> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-thymeleaf</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-tomcat</artifactid> <scope>provided</scope> </dependency> </dependencies> <properties> <start-class>hello.application</start-class> </properties> <build> <plugins> <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> </plugin> </plugins> </build> <repositories> <repository> <id>spring-milestones</id> <name>spring milestones</name> <url>http://repo.spring.io/libs-milestone</url> </repository> </repositories> <pluginrepositories> <pluginrepository> <id>spring-milestones</id> <name>spring milestones</name> <url>http://repo.spring.io/libs-milestone</url> </pluginrepository> </pluginrepositories> </project> is there idea overcome problem?
in project use own parent pom, because defines lot of stuff regarding company.
you removed parent, lost declaration of war plugin configuration. here is:
<plugin> <artifactid>maven-war-plugin</artifactid> <configuration> <failonmissingwebxml>false</failonmissingwebxml> </configuration> </plugin> see here source code.
Comments
Post a Comment