Maven Jetty plugin daemon element not allowed here

后端 未结 2 1739
执念已碎
执念已碎 2021-01-18 11:33

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

2条回答
  •  孤街浪徒
    2021-01-18 11:54

    I know I am four years late, but I am investigating on the same issue.

    If you update Jetty's dependency to 10.0.0, the error is solved: daemon does not produce that error anymore.

    However, things get weird if you update to 11.0.0 (latest, on Maven Central):

    • daemon starts producing error again,
    • scanIntervalSeconds produces error too, whereas it previously never did.

    So, I made some researches.

    I suspect you took your code from using jetty and maven-failsafe-plugin.

    I read some of the Jetty 11 Programming Guide, and found this paragraph:

    Here is an example, which turns on scanning for changes every ten seconds, and sets the webapp context path to /test:

    
      org.eclipse.jetty
      jetty-maven-plugin
      {VERSION}
      
        10
        
          /test
        
      
    
    

    Also, I found this other paragraph:

    Here’s an example of using the pre-integration-test and post-integration-test Maven build phases to trigger the execution and termination of Jetty:

    
      org.eclipse.jetty
      jetty-maven-plugin
      {VERSION}
      
        10
        foo
        9999
      
      
        
          start-jetty
          pre-integration-test
          
            start
          
          
            0
          
        
        
          stop-jetty
          post-integration-test
           
             stop
           
         
      
    
    

    Thus, I replaced the scanIntervalSeconds occurrences with scan. As result of this, IntelliJ didn't signal any error for the first occurrence anymore. However, the second occurrence still produces error.

    As far as daemon is concerned...

    On the old Jetty 9 documentation:

    For example, you can configure the plugin to start your webapp at the beginning of your unit tests and stop at the end. To do this, you need to set up a couple of execution scenarios for the Jetty plugin. You use the pre-integration-test and post-integration-test Maven build phases to trigger the execution and termination of Jetty:

    
      org.eclipse.jetty
      jetty-maven-plugin
      {VERSION}
      
        10
        foo
        9999
      
      
        
          start-jetty
          pre-integration-test
          
            start
          
          
            0
          
        
        
          stop-jetty
          post-integration-test
           
             stop
           
         
      
    
    

    The daemon is not even mentioned here. So, it is possible that Failsafe's documentation has an error, and daemon is not really needed.

    To conclude:

    • I have no clue why daemon worked on 10 and doesn't anymore in 11.
    • It seems it is not even necessary...

提交回复
热议问题