IntelliJ 中配置的 Maven pom.xml 错误
maven pom.xml error with configuration in IntelliJ
这样的pom.xml有问题
<build>
<finalName>console</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
像上面的代码、源和目标,编码标签在 IntelliJ IDEA 中显示为红色。
而这段代码在旧版本中是不存在的。因为我用 GIT 合并并提交了新版本的代码。此代码为新版本代码。
如果我将鼠标悬停在 <source>
上,则显示
Element source is not allowed here.
如果我将鼠标悬停在 <target>
,然后显示
Element target is not allowed here.
如果我将鼠标悬停在 <encoding>
,然后显示
Element encoding is not allowed here.
是和tomcat7-maven-plugin有关还是其他问题?
我所做的只是将此代码粘贴到 pom.xml.
tomcat7-maven-plugin 不支持源、目标、编码标签。
所以是源代码错误。
我解决了这个删除配置标签的问题。
可能只支持三个标签,例如:outputDirectory,finalName,attach.
tomcat7-maven-plugin 不支持源、目标、编码标签。
生成的jar文件如果是main sources,则命名为finalName的值加上“-sources”。否则,如果它是测试源,它将是 finalName 加上“-test-sources”。它将在指定的输出目录中生成。附加参数指定 java 源是否将附加到项目的工件列表。
参考站点:[在此处输入 link 描述][1]https://maven.apache.org/plugins/maven-source-plugin/examples/configureplugin.html
这样的pom.xml有问题
<build>
<finalName>console</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
像上面的代码、源和目标,编码标签在 IntelliJ IDEA 中显示为红色。
而这段代码在旧版本中是不存在的。因为我用 GIT 合并并提交了新版本的代码。此代码为新版本代码。
如果我将鼠标悬停在 <source>
上,则显示
Element source is not allowed here.
如果我将鼠标悬停在 <target>
,然后显示
Element target is not allowed here.
如果我将鼠标悬停在 <encoding>
,然后显示
Element encoding is not allowed here.
是和tomcat7-maven-plugin有关还是其他问题? 我所做的只是将此代码粘贴到 pom.xml.
tomcat7-maven-plugin 不支持源、目标、编码标签。
所以是源代码错误。
我解决了这个删除配置标签的问题。
可能只支持三个标签,例如:outputDirectory,finalName,attach.
tomcat7-maven-plugin 不支持源、目标、编码标签。
生成的jar文件如果是main sources,则命名为finalName的值加上“-sources”。否则,如果它是测试源,它将是 finalName 加上“-test-sources”。它将在指定的输出目录中生成。附加参数指定 java 源是否将附加到项目的工件列表。
参考站点:[在此处输入 link 描述][1]https://maven.apache.org/plugins/maven-source-plugin/examples/configureplugin.html