eclipse - “未找到 ID 为 'org.xtext.xtend' 的插件。” 错误
问题描述
我正在按照本教程构建语言服务器 https://www.eclipse.org/community/eclipse_newsletter/2017/may/article5.php
但是,当我尝试构建 shadowJar 时,我不断收到此错误:
D:\leaf\org.xtext.example.mydsl1.parent>gradle shadowJar
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\leaf\org.xtext.example.mydsl1.parent\build.gradle' line: 25
* What went wrong:
A problem occurred evaluating root project 'org.xtext.example.mydsl1.parent'.
> Plugin with id 'org.xtext.xtend' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
下面是我的父脚本的 build.gradle 文件
buildscript {
repositories {
jcenter()
}
plugins {
id "org.xtext.xtend" version "2.0.1"
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
classpath "org.xtext:xtext-gradle-plugin:2.0.1"
}
}
subprojects {
ext.xtextVersion = '2.16.0-SNAPSHOT'
repositories {
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
apply plugin: 'java'
apply plugin: 'org.xtext.xtend'
apply plugin: 'com.github.johnrengelman.shadow'
apply from: "${rootDir}/gradle/source-layout.gradle"
apply from: "${rootDir}/gradle/maven-deployment.gradle"
apply plugin: 'eclipse'
group = 'org.xtext.example.mydsl1'
version = '1.0.0-SNAPSHOT'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
configurations.all {
exclude group: 'asm'
}
}
解决方案
我再次创建了项目并使用了向导创建的代码。我选择语言服务器构建类型为“Fat jar”,因为我的目标是创建一个。除此之外,我将教程中给出的基本名称、分类器和版本添加到自动生成的代码中。shadowjar(在 .ide 文件夹的 build.gradle 文件中)是我更改的唯一代码部分。因此,我的 shadowjar 代码如下所示:
shadowJar {
baseName = 'dsl-language-server'
classifier = null
version = null
from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)
configurations = [project.configurations.runtime]
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA','schema/*',
'.options', '.api_description', '*.profile', '*.html', 'about.*', 'about_files/*',
'plugin.xml', 'modeling32.png', 'systembundle.properties', 'profile.list')
classifier = 'ls'
append('plugin.properties')
}
然后我通过 Windows PowerShell 导航到我的项目的父文件夹并使用命令“gradle shadowjar”构建它。它建得很好!构建的 jar 文件可以在 .ide 目录的 /build/libs/ 中找到。
推荐阅读
- oracle - 我可以在 PL/SQL 块中使用 REGEXP_LIKE 作为带有 IF 的条件,并且我的字符串将作为参数传递
- r - r data frame- convert values to text and rank from most to least occurrences per row
- sql-server - 使用 SQL Server Management Studio 中的导入/导出来减少数据库大小
- java - 无法提取结果集:休眠,oracle 数据库中的 SQL 语法异常
- python - 当我通过类名访问类的属性时,Python会调用什么方法?
- html - 将 div 的内容在 flex 中向右对齐
- angular - 谁能告诉我路由器的流程,它如何处理延迟加载模块中的路由配置和嵌套路由?
- javascript - 如何从 DOM 中读取并将值赋值给表单
- machine-learning - 计算机器和人之间的准确性
- sql - 有些项目以多个单位生产。找到那些在不同单位生产的物品并找到单位名称?