首页 > 解决方案 > Maven/Xtext:找不到字符串资源“_UI_DiagnosticRoot_diagnostic”

问题描述

我可以使用 Maven 构建我的 Xtext 项目的可执行 jar(我想自动化 CI 的过程)

但是,我在执行过程中有一个错误。即使出现此错误,执行也会成功。我为包目标附加了 pom.xml。

错误 :

    1    [main] ERROR xt.validation.ResourceValidatorImpl  - The string resource '_UI_DiagnosticRoot_diagnostic' could not be located
java.util.MissingResourceException: The string resource '_UI_DiagnosticRoot_diagnostic' could not be located
        at org.eclipse.emf.common.util.DelegatingResourceLocator.delegatedGetString(DelegatingResourceLocator.java:541)
        at org.eclipse.emf.common.util.DelegatingResourceLocator.getString(DelegatingResourceLocator.java:445)
        at org.eclipse.emf.common.util.DelegatingResourceLocator.getString(DelegatingResourceLocator.java:560)
        at org.eclipse.emf.common.util.DelegatingResourceLocator.getString(DelegatingResourceLocator.java:552)
        at org.eclipse.emf.ecore.util.Diagnostician.createDefaultDiagnostic(Diagnostician.java:111)
        at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:140)
        at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:147)
        at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:125)
        at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:91)
        at langage.generator.Main.runGenerator(Main.java:66)
        at langage.generator.Main.main(Main.java:35)

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>comp_go</groupId>  
    <artifactId>go.prettyprinter</artifactId>  
    <version>1</version>  

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       <java.version>1.8</java.version>
       <maven.compiler.source>1.8</maven.compiler.source>
       <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <finalName>Main</finalName>
        <sourceDirectory>src/langage/generator</sourceDirectory>
        <outputDirectory>target/classes</outputDirectory>
         <!-- PLUGINS -->
        <plugins>
            <plugin>
            <groupId>org.eclipse.xtend</groupId>    
            <artifactId>xtend-maven-plugin</artifactId>
            <version>2.23.0</version>
            <dependencies>
                <dependency>
                    <groupId>org.eclipse.platform</groupId>
                    <artifactId>org.eclipse.equinox.common</artifactId>
                    <version>3.10.0</version>
                </dependency>
            </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>langage.generator.Main</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <!-- DEPENDENCES -->
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.eclipse.emf/ecore -->
        <dependency>
            <groupId>org.eclipse.emf</groupId>
            <artifactId>org.eclipse.emf.ecore</artifactId>
            <version>2.6.0.v20100614-1136</version>
        </dependency>
        <dependency>
                <groupId>org.eclipse.emf</groupId>
                <artifactId>org.eclipse.emf.common</artifactId>
                <version>2.20.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.google.inject/guice -->
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>5.0.0-BETA-1</version>
        </dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.xtext/org.eclipse.xtext -->
<dependency>
    <groupId>org.eclipse.xtext</groupId>
    <artifactId>org.eclipse.xtext</artifactId>
    <version>2.23.0</version>
</dependency>
    </dependencies>
</project>

我猜错误来自依赖com.google.inject,它不是 100% 兼容,但这是一个真正的问题,管道因此而失败。

标签: mavenpackageexecutable-jarxtext

解决方案


推荐阅读