使用maven使用xtext 2.10.0无法解析依赖关系

时间:2016-09-08 11:00:18

标签: java eclipse maven xtext

在pom xml中将我们的xtext版本从2.8.1更新到2.10.0时,我收到消息

[INFO] ---------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (m
we2Launcher) on project com.myproject.model: Execution mwe2Launcher of goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java failed: Plugin org.codehaus.mojo:exec-
maven-plugin:1.2.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.codehaus.mojo:exec-maven-plugin:jar:1.2.1 -> org.eclipse.xtext:org.eclipse.xtext.xtext:jar:2.10.0 -> 
org.eclipse.xtext:org.eclipse.xtext.generator:jar:2.10.0 -> 
org.eclipse.xtext:org.eclipse.xtext.ecore:jar:2.10.0 -> 
org.eclipse.xtext:org.eclipse.xtext:jar:2.10.0 -> 
org.eclipse.xtext:org.eclipse.xtext.util:jar:[2.10.0]: No versions available 
for org.eclipse.xtext:org.eclipse.xtext.util:jar:[2.10.0] within specified range -> [Help 1]
[ERROR]

导致错误的maven代码:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <id>mwe2Launcher</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
                <arguments>
                <argument>/${project.basedir}/workflow/GenerateModels.mwe2</argument>
                </arguments>
                <includePluginDependencies>true</includePluginDependencies>
            </configuration>
            <dependencies>
            <dependency>
                    <groupId>org.eclipse.xtext</groupId>
                    <artifactId>org.eclipse.xtext.xtext</artifactId>
                    <version>${xtext-version}</version>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.xtext</groupId>
                    <artifactId>org.eclipse.xtext.xbase</artifactId>
                    <version>${xtext-version}</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <configuration combine.self="override">
            </configuration>                    
        </plugin>               
        <plugin>
            <groupId>org.eclipse.xtend</groupId>
            <artifactId>xtend-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我们的常规存储库是eclipse Mars存储库,但我也尝试过Neon

<repository>
        <id>p2.eclipse.neon</id>
        <url>http://download.eclipse.org/releases/neon/</url>
        <layout>p2</layout>
</repository>

甚至添加了xtext存储库以确保我得到了正确的repo

<repository>
        <id>Xtext Update Site</id>
        <url>http://download.eclipse.org/modeling/tmf/xtext/updates/releases/${xtext-version}</url>
        <layout>p2</layout>         
    </repository>

我对maven知之甚少,我不知道我在这里做错了什么。在我看来,存储库找不到org.eclipse.xtext.util:jar 2.10.0,但这应该存在。

我该怎么做才能解决错误?

2 个答案:

答案 0 :(得分:0)

您应该删除<repositories>部分。 xven的2.10.0工件可在Maven Central获得。

我刚刚使用您的<build>部分创建了一个模拟项目,丢失的工件org.eclipse.xtext:org.eclipse.xtext.util:jar:2.10.0已经解决得很好。

如果这不起作用,我就会开始检查settings.xml目录下主文件夹中的.m2

答案 1 :(得分:0)

擦除/删除p2存储库后构建。我不知道为什么会这样,也许用maven -U命令执行就足够了。

我使用了neon repository和xtext版本2.10.0