Java 9 automatic modules not found

后端 未结 1 1647
再見小時候
再見小時候 2021-02-04 10:32

I\'m trying to define a Java 9 module. I have defined something like:

module my.module.name {

}

Then many of my files started to give me error

1条回答
  •  北荒
    北荒 (楼主)
    2021-02-04 11:12

    Alright, the problem came out to be in the pom.xml! The reason I was getting "module not found" error during compilation was hidden behind a WARNING which I was thinking is not important, so I did not paste here in the logs. The warning was "zip END header not found". The reason for getting this warning was because I was having a "malformed jar" in my dependencies and thus the compiler was failing during parsing the module-info.java file and was producing the above errors. But which one was the "malformed" jar? It came out that it is this one (I used the method of exclusion one by one ... ):

        
            org.apache.sshd
            apache-sshd
            1.7.0
            pom
            
                
                    org.slf4j
                    slf4j-jdk14
                
            
        
    

    I got that dependency from https://mvnrepository.com when searching for apache sshd, I'm not exactly sure what does "type pom" mean, but I'm guessing, that because Apache Mina is a set of several projects, in this way you include all the projects ... anyway, I only needed apache-sshd-core from all the projects, so I changed the dependency to the following (the Apache Mina Dev community advised me about that, so thanks a lot to them!!!):

    
        org.apache.sshd
        sshd-core
        1.7.0
    
    

    and now all compiles just fine! Thanks a lot to everyone for the comments and the help!

    0 讨论(0)
提交回复
热议问题