Vaadin:如何将 META-INF/服务添加到战争中? [英] Vaadin: How to add META-INF/services to the war?

查看:82
本文介绍了Vaadin:如何将 META-INF/服务添加到战争中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Vaadin 7 maven web 项目,它有一些在 META-INF/services 上创建服务定义的注释.

I have a Vaadin 7 maven web project that has some annotations that create service definition on META-INF/services.

我将它添加到 pom 以便处理注释:

I added this to the pom so the annotations are processed:

<!-- Run annotation processors on src/main/java sources -->
<plugin>
    <groupId>org.bsc.maven</groupId>
    <artifactId>maven-processor-plugin</artifactId>
    <version>3.3.1</version>
    <executions>
        <execution>
            <id>process</id>
            <goals>
                <goal>process</goal>
            </goals>
            <phase>generate-sources</phase>
        </execution>
    </executions>
</plugin>

文件显示在 target/classes/META-INF/services 中,但没有进入最后的战争.

The files show within target/classes/META-INF/services but don't make it to the final war.

我尝试将文件夹添加到 maven-war-plugin 中,如下所示:

I tried adding the folder to the maven-war-plugin like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>3.0.0</version>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <packagingIncludes>target/classes/*</packagingIncludes>
    </configuration>
</plugin>

但是大多数 Vaadin 文件都没有进入战争,也不起作用.有什么想法吗?

But then most of the Vaadin files don't make it into the war and it doesn't work. Any idea?

推荐答案

我最终使用了这个不相关的答案中的方法:Maven:在战争构建的资源文件夹中包含文件夹.

I ended up using the approach from this unrelated answer: Maven: include folder in resource folder in the war build.

这是我最终做的:

             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <webResources>
                        <resource>
                            <directory>target/classes/META-INF/services</directory>
                            <includes>
                                <include>*.*</include>
                            </includes>
                            <targetPath>META-INF/services</targetPath>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

基本把services文件夹添加为资源,放在最后一战的正确位置.

Basically added the services folder as a resource and placed it on the right place of the final war.

这篇关于Vaadin:如何将 META-INF/服务添加到战争中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆