eclipse maven pom.xml <packaging> tag error

159 views Asked by At

I wanted to build something different depending on the situation by allowing you to receive parameters in the tag of maven. There is no problem with the build of maven. However, Eclipse displays an error warning.

enter image description here

enter image description here

I will also share the pom.xml setup file.

<packaging>${packaging.type}</packaging>
<profiles>
<profile>
    <id>desktop</id>
    <properties>
        <packaging.type>eclipse-plugin</packaging.type>
    </properties>
</profile>

<profile>
    <id>console</id>
    <activation>
        <property>
            <name>consoleBuild</name>
            <value>true</value>
        </property>
    </activation>
    
    <properties>
        <packaging.type>jar</packaging.type>
    </properties>
 </profile>
 </profiles>

Can I turn off the warning?

I have tried the eclipse settings

  1. Go to Window > Preferences > Validation and uncheck the manual and build for: XML Schema Validator, XML Validator

  2. Right-click on the project, select Properties > Validation and uncheck the manual and build for: XML Schema Validator, XML Validator

But the warning is displayed as it is...

I checked all Maven settings on Eclipse. Is it never possible to ignore this warning?

IDEA seems to ignore alerts using tags such as <! – @startIgnoreUnknownXML –> ... <! – @endIgnoreUnknownXML –> but Eclipse doesn't have this option?

Please advise if there is a better way other than what I thought. Thank you.

1

There are 1 answers

5
howlger On

You just need to specify your packaging.type property also at the top level to avoid this warning (the value set in the profile will override the value set at the top level):

<properties>
    <packaging.type>jar</packaging.type>
</properties>
<packaging>${packaging.type}</packaging>

Better do not build the artifacts twice. Instead, publish/install the Eclipse plugin you built to your local Maven repository or deploy it to a remote Maven repository, from which you can then use the same JAR as a regular Maven dependency.