Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven pom.xml error with configuration in IntelliJ

There is a problem in the pom.xml like this.

<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>

Like above code, source and target, encoding tag is shown as red color in IntelliJ IDEA.
And this code did not exist in old version. Cause I merged and committed this code with new version with GIT. This code is new version's code.

If I hover the mouse at the <source>, then it says

Element source is not allowed here.

If I hover the mouse at the <target>, then it says

Element target is not allowed here.

If i hover the mouse at the <encoding>, then it says

Element encoding is not allowed here.

Is it related with tomcat7-maven-plugin or other problems? All i did is just paste this code to pom.xml.

like image 640
Moon Taejin Avatar asked Mar 17 '16 05:03

Moon Taejin


2 Answers

tomcat7-maven-plugin doesn't support source, target, encoding tags.

so it was wrong source code.

I solved this problem removing configuration tag.

like image 70
Moon Taejin Avatar answered Nov 20 '22 08:11

Moon Taejin


It only maybe support three tags , For Example : outputDirectory,finalName,attach.

tomcat7-maven-plugin doesn't support source,target,encoding tag.

The generated jar file will be named by the value of the finalName plus "-sources" if it is the main sources. Otherwise, it would be finalName plus "-test-sources" if it is the test sources. It will be generated in the specified outputDirectory. The attach parameter specifies whether the java sources will be attached to the artifact list of the project.

Reffering to site:[enter link description here][1]https://maven.apache.org/plugins/maven-source-plugin/examples/configureplugin.html

like image 1
youchuikai Avatar answered Nov 20 '22 08:11

youchuikai