java - Maven:cvc-complex-type.2.4.a:发现以元素“插件”开头的无效内容
问题描述
我对 Maven pom.xml 配置不是很好。
对于 Corda (Blockchain) Bootcamp 示例,我正在尝试配置一个 Eclipse 项目以与 Java 和 Kotlin 一起使用,但我面临以下错误消息:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'plugin'.
One of '{
"http://maven.apache.org/POM/4.0.0":parent,
"http://maven.apache.org/POM/4.0.0":packaging,
"http://maven.apache.org/POM/4.0.0":name,
"http://maven.apache.org/POM/4.0.0":description,
"http://maven.apache.org/POM/4.0.0":url,
"http://maven.apache.org/POM/4.0.0":prerequisites,
"http://maven.apache.org/POM/4.0.0":issueManagement,
"http://maven.apache.org/POM/4.0.0":ciManagement,
"http://maven.apache.org/POM/4.0.0":inceptionYear,
"http://maven.apache.org/POM/4.0.0":mailingLists,
"http://maven.apache.org/POM/4.0.0":developers,
"http://maven.apache.org/POM/4.0.0":contributors,
"http://maven.apache.org/POM/4.0.0":licenses,
"http://maven.apache.org/POM/4.0.0":scm,
"http://maven.apache.org/POM/4.0.0":organization,
"http://maven.apache.org/POM/4.0.0":profiles,
"http://maven.apache.org/POM/4.0.0":modules,
"http://maven.apache.org/POM/4.0.0":repositories,
"http://maven.apache.org/POM/4.0.0":pluginRepositories,
"http://maven.apache.org/POM/4.0.0":dependencies,
"http://maven.apache.org/POM/4.0.0":reports,
"http://maven.apache.org/POM/4.0.0":reporting,
"http://maven.apache.org/POM/4.0.0":dependencyManagement,
"http://maven.apache.org/POM/4.0.0":distributionManagement
}' is expected.
这是整个 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>r3</groupId>
<artifactId>CordaAppBootCamp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<kotlin.version>1.2.51</kotlin.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</project>
我究竟做错了什么?
我是在这个 Baeldung 帖子中这样做的:
https://www.baeldung.com/kotlin-maven-java-project
它有更多的问题信息。其中一些我通过使用<pluginManagement>
标签解决了
解决方案
看看较新版本的 Bootcamp cordapp,gradle 现在为您处理所有这些,因此您无需担心自己的依赖关系。
https://github.com/corda/bootcamp-cordapp
另请注意,推荐的 IDE 实际上是 IntelliJ IDEA,不再是 eclipse。(来源:https ://docs.corda.net/docs/corda-os/4.4/getting-set-up.html )
推荐阅读
- reactjs - 在单独的文件中反应放置标题
- spring - 有没有办法在不从数据库中检索对象的情况下将对象添加到 spring 的持久性上下文中?
- java - 使用 navigationComponent 保留 BottomNavigationView 中哪个片段处于活动状态
- octave - 'endif' 命令与 octave 中的 'endfor' 问题匹配
- php - 除非我检查元素,否则不会设置 Cookie
- jaxb - JAXB - 以小写字母开头的重复元素
- python - 有效地从熊猫字典列中提取数据
- pandas - Pandas DataFrame 和系列 - IB TWS 历史数据
- perl - 用不一致的记录分隔符/行读入文件
- sql - Oracle SQL:在 CASE 语句中使用相同的别名在一种情况下选择一列,在其他两列和另外三列中选择相同的别名