我已经用Vaadin实现了一个Web应用程序,并在Spring Boot中运行。 Maven用于构建可执行的jar包。运行得很好。
但是现在我添加了一个自定义的小部件集...只是一个渲染器,以便能够在网格(https://vaadin.com/forum/#!/thread/9225584/10109123)内使用真棒字体标记的按钮。

在Maven构建过程中,我可以看到将对小部件集进行编译。我希望编译后的小部件集位于文件夹VAADIN / widgetsets /中,但在jar包中会丢失。
如果将pom.xml中的包装信息更改为“ war”,则将小部件集复制到包装中。

有什么想法可以将已编译的小部件集复制到jar中吗?

这是我的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>de.myCompany.app</groupId>
  <artifactId>web-ui</artifactId>
  <version>1.1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Web-UI</name>
  <description>Web UI</description>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.1.RELEASE</version>
  </parent>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <aspectj.skip>false</aspectj.skip>
    <jgitflow.version>1.0-m5.1</jgitflow.version>

    <!-- dependencies version -->
    <vaadin.version>7.5.4</vaadin.version>
    <app.version>2.3.0-SNAPSHOT</app.version>
    <jason.version>1.4.0-SNAPSHOT</jason.version>

    <!-- application.properties -->
    <server.port>8085</server.port>
  </properties>

  <scm>
     <connection>scm:git:[email protected]:WebUI.git</connection>
    <developerConnection>scm:git:[email protected]:WebUI.git</developerConnection>
    <tag>HEAD</tag>
</scm>

<distributionManagement>
    <repository>
        <id>nexus</id>
        <name>Internal Releases</name>
        <url>https://nexus.sb.intranet.de/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>nexus</id>
        <name>Internal Snapshots</name>
        <url>https://nexus.sb.intranet.de/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>

        <!-- Ensure the widgetset directory is cleaned properly -->
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.6.1</version>
            <configuration>
                <filesets>
                    <fileset>
                        <!-- Clean-up widgetset required for "inplace" compilation -->
                        <directory>${basedir}/src/main/webapp/VAADIN/widgetsets</directory>
                    </fileset>
                    <fileset>
                        <!-- Clean-up gwt cache -->
                        <directory>${basedir}/src/main/webapp/VAADIN/gwt-unitCache</directory>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>

        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>${vaadin.version}</version>
            <configuration>
                <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
                <hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
                <noServer>true</noServer>
                <persistentunitcachedir>${basedir}/target/tmp/gwt-unitCache</persistentunitcachedir>
                <compileReport>true</compileReport>
                <strict>true</strict>
                <runTarget>http://localhost:${server.port}/</runTarget>
            </configuration>
            <executions>
                <execution>
                    <configuration>
                        <!-- no specified modules; the plugin will find them automatically-->
                    </configuration>
                    <goals>
                        <!--goal>clean</goal>
                        <goal>resources</goal>
                        <goal>update-theme</goal>
                        <goal>update-widgetset</goal>
                        <goal>compile-theme</goal>
                        <goal>compile</goal-->
                        <goal>resources</goal>
                        <goal>update-widgetset</goal>
                        <goal>compile</goal>
                        <goal>resources</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.1</version>
            <configuration>
                <tags>
                    <tag>
                        <name>company</name>
                        <placement>a</placement>
                        <head>Company:</head>
                    </tag>
                    <tag>
                        <name>date</name>
                        <placement>a</placement>
                        <head>Creation:</head>
                    </tag>
                </tags>
                <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
        </plugin>

        <plugin>
            <groupId>external.atlassian.jgitflow</groupId>
            <artifactId>jgitflow-maven-plugin</artifactId>
            <version>${jgitflow.version}</version>
            <configuration>
                <allowSnapshots>true</allowSnapshots>
                <flowInitContext>
                    <masterBranchName>master</masterBranchName>
                    <developBranchName>develop</developBranchName>
                    <releaseBranchPrefix>release-</releaseBranchPrefix>
                    <hotfixBranchPrefix>hotfix-</hotfixBranchPrefix>
                    <versionTagPrefix>V</versionTagPrefix>
                </flowInitContext>
            </configuration>
        </plugin>

    </plugins>

    <resources>
        <resource>
            <directory>src/main/webapp</directory>
            <filtering>true</filtering>
            <excludes>
                <exclude>**/*.scss</exclude>
            </excludes>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>platforms.json</include>
            </includes>
            <targetPath>${project.build.directory}/config</targetPath>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

<dependencies>
    <dependency>
        <groupId>org.vaadin.spring</groupId>
        <artifactId>spring-boot-vaadin</artifactId>
        <version>0.0.3</version>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-server</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client-compiler</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client-compiled</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-themes</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.4</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.1.0.Final</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.4</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${project.parent.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>de.myCompany.app</groupId>
        <artifactId>generic-agent-control-common</artifactId>
        <version>${app.version}</version>
    </dependency>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>2.7.0</version>
    </dependency>
    <dependency>
        <groupId>de.myCompany.app</groupId>
        <artifactId>control-client</artifactId>
        <version>1.5.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>de.myCompany.app</groupId>
        <artifactId>control-json</artifactId>
        <version>${app.version}</version>
    </dependency>
</dependencies>

<profiles>
    <profile>
        <!--This profile setup logging level to dump only errors out. To
        contribute with this mechanism the placeholders "${logger.level}" and "${logger.app.level}"
        must be used inside the lockback.xml file or "application.properties" for level definitions
        instead of fix level definitions like "info", "debug",.. -->
        <id>quiet</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <logger.level>ERROR</logger.level>
            <logger.app.level>WARN</logger.app.level>
            <surefire.reportFormat>plain</surefire.reportFormat>
            <surefire.printSummary>true</surefire.printSummary>
            <surefire.useFile>true</surefire.useFile>
        </properties>
    </profile>
    <profile>
        <!-- This profile setup logging level to dump detailed informations.
        See profile "quietTest" above for more details -->
        <id>verbose</id>
        <properties>
            <logger.level>DEBUG</logger.level>
            <logger.app.level>TRACE</logger.app.level>
            <surefire.reportFormat>plain</surefire.reportFormat>
            <surefire.printSummary>true</surefire.printSummary>
            <surefire.useFile>false</surefire.useFile>
        </properties>
    </profile>
    <profile>
        <!--+ This profile setup logging level to dump detailed informations.
        See profile "quietTest" above for more details + -->
        <id>info</id>
        <activation>
            <property>
                <name>verboseTest</name>
            </property>
        </activation>
        <properties>
            <logger.level>WARN</logger.level>
            <logger.app.level>INFO</logger.app.level>
            <surefire.reportFormat>plain</surefire.reportFormat>
            <surefire.printSummary>true</surefire.printSummary>
            <surefire.useFile>false</surefire.useFile>
        </properties>
    </profile>
</profiles>

最佳答案

@morfic谢谢您的启发。 :-)

这是我的解决方案,效果很好! (同样在带有Vaadin插件的Netbeans IDE中):


我将vaadin maven插件的执行阶段设置为“编译”
我在执行阶段'process-classes'中添加了一个附加的maven资源插件


这是我的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>

<groupId>de.myCompany.app</groupId>
<artifactId>web-ui</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Web-UI</name>
<description>Web UI</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.1.RELEASE</version>
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <aspectj.skip>false</aspectj.skip>
    <jgitflow.version>1.0-m5.1</jgitflow.version>

    <!-- dependencies version -->
    <vaadin.version>7.5.4</vaadin.version>
    <app.version>2.3.0-SNAPSHOT</app.version>
    <jason.version>1.4.0-SNAPSHOT</jason.version>

    <!-- application.properties -->
    <server.port>8085</server.port>
</properties>

<scm>
    <connection>scm:git:[email protected]:WebUI.git</connection>
    <developerConnection>scm:git:[email protected]:WebUI.git</developerConnection>
    <tag>HEAD</tag>
</scm>

<distributionManagement>
    <repository>
        <id>nexus</id>
        <name>Internal Releases</name>
        <url>https://nexus.sb.intranet.de/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>nexus</id>
        <name>Internal Snapshots</name>
        <url>https://nexus.sb.intranet.de/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>

        <!-- Ensure the widgetset directory is cleaned properly -->
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.6.1</version>
            <configuration>
                <filesets>
                    <fileset>
                        <!-- Clean-up widgetset required for "inplace" compilation -->
                        <directory>${basedir}/src/main/webapp/VAADIN/widgetsets</directory>
                    </fileset>
                    <fileset>
                        <!-- Clean-up gwt cache -->
                        <directory>${basedir}/src/main/webapp/VAADIN/gwt-unitCache</directory>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>

        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>${vaadin.version}</version>
            <configuration>
                <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
                <hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
                <noServer>true</noServer>
                <persistentunitcachedir>${basedir}/target/tmp/gwt-unitCache</persistentunitcachedir>
                <compileReport>true</compileReport>
                <strict>true</strict>
                <runTarget>http://localhost:${server.port}/</runTarget>
            </configuration>
            <executions>
                <execution>
                    <configuration>
                        <!-- no specified modules; the plugin will find them automatically-->
                    </configuration>
                    <phase>compile</phase>
                    <goals>
                        <goal>clean</goal>
                        <goal>resources</goal>
                        <goal>update-theme</goal>
                        <goal>update-widgetset</goal>
                        <goal>compile-theme</goal>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.1</version>
            <configuration>
                <tags>
                    <tag>
                        <name>company</name>
                        <placement>a</placement>
                        <head>Company:</head>
                    </tag>
                    <tag>
                        <name>date</name>
                        <placement>a</placement>
                        <head>Creation:</head>
                    </tag>
                </tags>
                <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.7</version>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${basedir}/target/classes</outputDirectory>
                        <resources>
                            <resource>
                                <directory>src/main/webapp</directory>
                                <excludes>
                                    <exclude>**/*.scss</exclude>
                                </excludes>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>external.atlassian.jgitflow</groupId>
            <artifactId>jgitflow-maven-plugin</artifactId>
            <version>${jgitflow.version}</version>
            <configuration>
                <allowSnapshots>true</allowSnapshots>
                <flowInitContext>
                    <masterBranchName>master</masterBranchName>
                    <developBranchName>develop</developBranchName>
                    <releaseBranchPrefix>release-</releaseBranchPrefix>
                    <hotfixBranchPrefix>hotfix-</hotfixBranchPrefix>
                    <versionTagPrefix>V</versionTagPrefix>
                </flowInitContext>
            </configuration>
        </plugin>

    </plugins>

    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>platforms.json</include>
            </includes>
            <targetPath>${project.build.directory}/config</targetPath>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

<dependencies>
    <dependency>
        <groupId>org.vaadin.spring</groupId>
        <artifactId>spring-boot-vaadin</artifactId>
        <version>0.0.3</version>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-server</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client-compiler</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client-compiled</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-themes</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.4</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.1.0.Final</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.4</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${project.parent.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>de.myCompany.app</groupId>
        <artifactId>control-common</artifactId>
        <version>${app.version}</version>
    </dependency>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>2.7.0</version>
    </dependency>
    <dependency>
        <groupId>de.myCompany.app</groupId>
        <artifactId>control-client</artifactId>
        <version>1.5.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>de.myCompany.app</groupId>
        <artifactId>generic-agent-control-json</artifactId>
        <version>${app.version}</version>
    </dependency>
</dependencies>

<profiles>
    <profile>
        <!--This profile setup logging level to dump only errors out. To
        contribute with this mechanism the placeholders "${logger.level}" and "${logger.app.level}"
        must be used inside the lockback.xml file or "application.properties" for level definitions
        instead of fix level definitions like "info", "debug",.. -->
        <id>quiet</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <logger.level>ERROR</logger.level>
            <logger.app.level>WARN</logger.app.level>
            <surefire.reportFormat>plain</surefire.reportFormat>
            <surefire.printSummary>true</surefire.printSummary>
            <surefire.useFile>true</surefire.useFile>
        </properties>
    </profile>
    <profile>
        <!-- This profile setup logging level to dump detailed informations.
        See profile "quietTest" above for more details -->
        <id>verbose</id>
        <properties>
            <logger.level>DEBUG</logger.level>
            <logger.app.level>TRACE</logger.app.level>
            <surefire.reportFormat>plain</surefire.reportFormat>
            <surefire.printSummary>true</surefire.printSummary>
            <surefire.useFile>false</surefire.useFile>
        </properties>
    </profile>
    <profile>
        <!--+ This profile setup logging level to dump detailed informations.
        See profile "quietTest" above for more details + -->
        <id>info</id>
        <activation>
            <property>
                <name>verboseTest</name>
            </property>
        </activation>
        <properties>
            <logger.level>WARN</logger.level>
            <logger.app.level>INFO</logger.app.level>
            <surefire.reportFormat>plain</surefire.reportFormat>
            <surefire.printSummary>true</surefire.printSummary>
            <surefire.useFile>false</surefire.useFile>
        </properties>
    </profile>
</profiles>

08-06 15:21