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
(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
...
<!-- A) PROBLEM: dependency resolution can't work in [web]/src/**/* -->
<version>1.0-SNAPSHOT</version>
<!-- B) OK: this is what we (and probably you) wanted -->
<!-- <version>2.0.1-SNAPSHOT</version> -->
...
|- [web]
|- pom.xml
...
<version>2.0.1-SNAPSHOT</version>
...
<dependency>
<groupId>...</groupId>
<artifactId>projx-ejb</artifactId>
<type>ejb</type>
<!-- C) a specific older version here would help it as well
if you need it -->
<!-- <version>1.0.3.Final</version> -->
<scope>provided</scope>
</dependency>
...
|- [ear]
|- pom.xml
...
<version>2.0.1-SNAPSHOT</version>
...
|- pom.xml
<project ...>
...
<version>2.0.1-SNAPSHOT</version>
...
<modules>
<module>ejb</module>
<module>web</module>
<module>ear</module>
</modules>
...
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.)
As has been previously mentioned, you can't modify .class files. You can download the source java files of the dependencies if available via:
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
Class files are compiled binaries poised to be part of executable programs.
To modify them is an art in modifying compiled source code. You probably don't want to do that. If you want to generate a replacement, download the whole project and recompile it.
You may be obligated to do certain other things under such an action, by law you must abide by the licensing of the software, and recompiling and redistributing (which is what you'll be doing if you must recompile) often puts much heavier burdens on the developer than just "using" (depending on the licensing).
You cannot edit .class
file(s). You can only edit java
file(s) contained in the source code and recompile.
The sources that are downloaded by maven
are a project SNAPSHOT generated by the maven source plugin
for a given project at a given time, to aid in investigating the code, but certainly not to modify it.
These sources can be bound to the classpath and used for navigating the project source in an IDE, but they still remain read-only.
You cannot edit jars and source jars directly. You'd need to download the source code, and edit that. You'd then have to go through the build process to re-build the jar, and install it as a new version in your maven repository.