how to edit `.class` file in Maven dependency in Eclipse

后端 未结 5 920
臣服心动
臣服心动 2021-01-12 16:32

Ok, so I have my Java projects, and under the Maven dependency project folder on the project explorer, I encounter a jar folder, and in it there is a .cla

5条回答
  •  误落风尘
    2021-01-12 16:56

    (for confused readers: it's about Eclipse knowing via Maven config how to jump to the known/available (possibly own) project source file to edit it when it is actually linked in the code via some previously packaged jar (with *.class files in it))

    (We had the same problem, but it had worked before after some adjustments and we spend quite some time to figure this out ... )

    our (typical EAR archetype) dir structure:

    [projx]
      |- [ejb]
           |- pom.xml
                ...
                
                1.0-SNAPSHOT
    
                
                
                ...
      |- [web]
           |- pom.xml
                ...
                2.0.1-SNAPSHOT
                ...
                
                    ...
                    projx-ejb
                    ejb
    
                    
                    
    
                    provided
                
                ...
      |- [ear]
           |- pom.xml
                ...
                2.0.1-SNAPSHOT
                ...
      |- pom.xml
    
           
            ...
            2.0.1-SNAPSHOT
            ...
            
              ejb
              web
              ear
            
            ...
    

    So the problem was that we forgot to increase the [ejb]/pom.xml//project/version (A)). After adjusting it similar to B) (we actually reference a global [projx]/pom.xml//project/properties/projx.version property), it worked again like a charm.

    (If we would have had depended explicitely on an older, e.g. `projx-ejb-1.0.3.Final.jar, JAR version, we could have gone for the C) approach where of course the workspace resolution again would not work, rightously.)

提交回复
热议问题