Maven Jetty plugin daemon element not allowed here

2019-06-19 12:29发布

问题:

I am trying to configure a project's pom.xml file. I want it to start Jetty server in testing phase. In order to do it I should add "daemon" element to Jetty plugin as I did below, but IntelliJ warns me with "Element daemon is not allowed here." Can you please help me? What is the reason?

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.2.11.v20150529</version>
            <configuration>
                <httpConnector>
                    <port>8083</port>
                </httpConnector>
            </configuration>
            <executions>
                <execution>
                    <id>start-jetty</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <scanIntervalSeconds>0</scanIntervalSeconds>
                        <daemon>true</daemon>
                    </configuration>
                </execution>
                <execution>
                    <id>stop-jetty</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

回答1:

It's actually a IntelliJ Idea's bug. It sometimes doesn't recognize some of configuration properties correctly. The plugin does have this property, so you don't really have other option than to just ignore the error in IDE. The plugin will work as expected.