在编译

时间:2017-09-12 14:52:13

标签: maven vaadin maven-plugin vaadin7 vaadin8

最近我们将Vaadin 7更新为Vaadin 8.我们的一个组件没有工作,今天在分析问题时我发现它仍然是Vaadin 7,并且存在不匹配。所以我将组件更新为Vaadin 8(虽然目前仍在使用所有.v7库,并在UI类上添加了@Widgetset("com.vaadin.v7.Vaadin7WidgetSet"),并添加了vaadin-compatibility-client-compiled maven依赖项。<登记/> 我们对该组件的测试-WW再次正常工作,我将这个新版本部署到我们的Nexus(使用TODO实际更新所有Vaadin 7和Viritin组件到Vaadin 8)。

现在在我们的主项目中(我们使用此组件)我已经在pom.xml中更新了它的版本,但是在运行时它给出了与之前添加{{}之前相同的错误1}}到组件的UI类。我们的主项目已经有@Widgetset,其中包含我们的自定义Widgetset。我想我只是将@Widgetset作为com.vaadin.v7.Vaadin7WidgetSet添加到我们主项目的<inherits>文件中,但是当我执行并保存时,一些Maven插件会自动将其重置为它是

这就是我们Widgetset.gwt.xml目前的样子:

Widgetset.gwt.xml

当我尝试添加这两行时:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
        "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.vaadin.DefaultWidgetSet" />

    <stylesheet src="resetbuttonfortextfield/styles.css" />
</module>

保存后只剩下TODO评论。由于这个项目的同事都住在当下晚上的世界的另一边,我无法真正联系他们寻求帮助,所以我选择使用StackOverflow。

以下是我们的<!-- TODO: Remove following inherit after Templates Component has been migrated to Vaadin 8 --> <inherits name="com.vaadin.v7.Vaadin7WidgetSet" /> 作为参考,我认为此处导致pom.xml在保存后重置:

Widgetset.gwt.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"> <parent> <groupId>our.project</groupId> <artifactId>web-parent</artifactId> <version>develop-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>web2-widgetset</artifactId> <name>web2-widgetset</name> <packaging>jar</packaging> <dependencies> <!-- Versions for these are configured in the parent POM --> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-server</artifactId> </dependency> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-client</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-client-compiler</artifactId> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>com.vaadin</groupId> <artifactId>vaadin-maven-plugin</artifactId> <configuration> <extraJvmArgs>-Xmx1024M -Xss2048k</extraJvmArgs> <webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory> <draftCompile>true</draftCompile> <compileReport>false</compileReport> <!-- Change to PRETTY (or possibly DETAILED) to get unobfuscated client side stack traces. A better approach for debugging is to use Super Dev Mode --> <style>OBF</style> <strict>true</strict> </configuration> <executions> <execution> <goals> <goal>update-widgetset</goal> <goal>compile</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifestEntries> <Vaadin-Package-Version>1</Vaadin-Package-Version> <Vaadin-Widgetsets>our.project.Widgetset</Vaadin-Widgetsets> </manifestEntries> </archive> <!-- Exclude some unnecessary files generated by the GWT compiler. --> <excludes> <exclude>VAADIN/gwt-unitCache/**</exclude> <exclude>VAADIN/widgetsets/WEB-INF/**</exclude> </excludes> </configuration> </plugin> </plugins> </build> </project> vaadin-maven-plugin负责删除<goal>update-widgetset</goal>中的<inherits> - 代码,但我并不完全确定。一般来说,我对Maven来说还是比较新的 但是,如果我是对的,我该如何修改Widgetset.gwt.xml,以便它还会添加此pom.xml - 我需要的代码?

TL; DR:如何在我的<inherits>中永久添加额外的<inherits>标记(我们的Maven中没有插入Widgetset.gwt.xml覆盖这些手册改变)?

编辑:如果我发表评论pom.xml <goal>update-widgetset</goal>已不再更新,但它在Widgetset.gwt.xml中出错:

pom.xml

这是导致GWT Module com.vaadin.v7.Vaadin7WidgetSet not found in project sources or resources. (com.vaadin:vaadin-maven-plugin:8.0.6:compile:default:process-classes) org.apache.maven.plugin.MojoExecutionException: GWT Module com.vaadin.v7.Vaadin7WidgetSet not found in project sources or resources. at org.codehaus.mojo.gwt.shell.CompileMojo.compilationRequired(CompileMojo.java:701) at org.codehaus.mojo.gwt.shell.CompileMojo.compile(CompileMojo.java:567) at org.codehaus.mojo.gwt.shell.CompileMojo.doExecute(CompileMojo.java:435) at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:182) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360) at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52) at com.vaadin.integration.eclipse.maven.VaadinMojoExecutionBuildParticipant.build(VaadinMojoExecutionBuildParticipant.java:87) at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172) at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86) at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Caused by: org.codehaus.mojo.gwt.utils.GwtModuleReaderException: GWT Module com.vaadin.v7.Vaadin7WidgetSet not found in project sources or resources. at org.codehaus.mojo.gwt.AbstractGwtModuleMojo.readModule(AbstractGwtModuleMojo.java:209) at org.codehaus.mojo.gwt.GwtModule.getLocalInherits(GwtModule.java:189) at org.codehaus.mojo.gwt.GwtModule.getInherits(GwtModule.java:149) at org.codehaus.mojo.gwt.GwtModule.getEntryPoints(GwtModule.java:114) at org.codehaus.mojo.gwt.shell.CompileMojo.compilationRequired(CompileMojo.java:615) ... 36 more 自动删除的正确方向的重要一步。好像我需要弄清楚相关的依赖关系,如果我理解的话,将其添加到<inherits>

1 个答案:

答案 0 :(得分:1)

好的,修好了。我遇到了其他人将Vaadin 7迁移到8并且与Widgetset有一些问题的帖子:https://vaadin.com/forum/#!/thread/15031831/15036434

第一个回复(我在这里引用)解决了我的问题:

  

嗨,很高兴知道您正在享受新版本:)请检查以下内容:

     
      
  • 您必须使用vaadin-server 替换 vaadin-compatibility-server依赖关系。
  •   
  • 如果您使用的是默认widgetset(您不是自己编译):      
        
    • vaadin-client-compiled依赖项替换为<{1}}。
    •   
    • vaadin-compatibility-client-compiled添加到您的UI实施中。
    •   
  •   
  • 如果您使用的是自定义widgetset:      
        
    • @Widgetset("com.vaadin.v7.Vaadin7WidgetSet")依赖项替换为<{1}}。
    •   
    • 重新编译。
    •   
  •   

所以我在Widgetset vaadin-client中使用vaadin-compatibility-client更改了vaadin-client,现在vaadin-compatibility-client - 标记仍然存在。