Issue
There is a class in a maven dependency that is incompatible with Java 8.
How do you properly fix that problem?
Right now I'm doing the following:
- Create a package with the same name
- Create a class with the same name in that package
- Copy and paste the code
- Fix the incompatible API call
The problem is that this class contains API calls to restricted classes and although I changed the Eclipse compiler settings (Window -> Preferences -> Java -> Compiler -> Error/Warnings -> Deprecated and restricted API -> Forbidden reference (access rule): Error -> Warning) to allow access the project will only compile sometimes. If it doesn't compile I'll get a "can't find symbol" error.
Edit:
Here are the details you asked for:
Dependency: http://mvnrepository.com/artifact/com.sun.xml.wss/xws-security/3.0
Class: EncryptionProcessor
Necessary change:
// Change line 1053 FROM: // _dataEncryptor = XMLCipher.getInstance(dataEncAlgo, _dataCipher); // TO: _dataEncryptor = XMLCipher.getInstance(dataEncAlgo);
Edit-2:
Maven build error:
[ERROR] symbol: class XMLCipher
[ERROR] location: class com.sun.xml.wss.impl.apachecrypto.EncryptionProcessor
[ERROR] /C:/Users/{name}/development/eclipse_workspace/git/xws-security/src/main/java/com/sun/xml/wss/impl/apachecrypto/EncryptionProcessor.java:[1482,98] cannot find symbol
Solution
General solution:
- download all project sources
- apply your modification
- use version control so that change isn't lost
- change version in
pom.xml
, for example from3.0
to3.0-patched
- launch maven build
- copy generated artifacts to you repository/Artifactory, if you use one
- change dependency version in your own project
Answered By - user158037
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.