Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/deprecate java 8 stage 2 #252

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions core/src/main/java/com/devonfw/tools/solicitor/Solicitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import com.devonfw.tools.solicitor.SolicitorCliProcessor.CommandLineOptions;
import com.devonfw.tools.solicitor.SolicitorSetup.ReaderSetup;
import com.devonfw.tools.solicitor.common.DeprecationChecker;
import com.devonfw.tools.solicitor.common.LogMessages;
import com.devonfw.tools.solicitor.common.MavenVersionHelper;
import com.devonfw.tools.solicitor.common.ResourceToFileCopier;
Expand Down Expand Up @@ -66,6 +67,9 @@ public class Solicitor {
@Autowired
private LifecycleListenerHolder lifecycleListenerHolder;

@Autowired
private DeprecationChecker deprecationChecker;

private boolean tolerateMissingInput = false;

@Value("${solicitor.tolerate-missing-input}")
Expand Down Expand Up @@ -111,6 +115,7 @@ private void extractConfig(String targetDir) {
*/
private void mainProcessing(CommandLineOptions clo) {

checkJavaVersion();
ModelRoot modelRoot = this.configFactory.createConfig(clo.configUrl);
this.lifecycleListenerHolder.modelRootInitialized(modelRoot);
if (clo.load) {
Expand All @@ -136,6 +141,20 @@ private void mainProcessing(CommandLineOptions clo) {
this.lifecycleListenerHolder.endOfMainProcessing(modelRoot);
}

/**
* Checks the java version and possibly issue deprecation error or warning.
*/
private void checkJavaVersion() {

String javaVersion = System.getProperty("java.version");
// we just check for the prefix "1." because from Java 9 on the version number does no longer start with "1."
if (javaVersion.startsWith("1.")) {
this.deprecationChecker.check(false,
"Running Solicitor on Java 8 is deprecated. Yours is '" + javaVersion + "'. Switch to Java 11!");
}

}

/**
* Read the inventory of {@link ApplicationComponent}s and their declared licenses.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public enum LogMessages {
DEPRECATIONS_ACTIVE(42,
"Deprecated features are available ({}). Please check if this is necessary. Look for message code '{}' to check for actually used deprecated features."), //
UNAVAILABLE_DEPRECATED_FEATURE(43,
"This featue is deprecated and no longer available. Details: {}. For backward compatibility you might temporary activate it by setting '{}'."), //
"This feature is deprecated and no longer available. Details: {}. For backward compatibility you might temporary activate it by setting '{}'."), //
USING_DEPRECATED_FEATURE_FORCED(44,
"You are using a deprecated feature which is only available because you set {}. You should ASAP migrate your project as this might be unavailable in future versions. Details: {}."), //
MISSING_INVENTORY_INPUT_FILE(45,
Expand Down
7 changes: 6 additions & 1 deletion documentation/master-solicitor.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ A "normalized" license id might be either a SPDX-Id, a `LicenseRef`-Id or a "pse

== Usage
=== Executing Solicitor
_Solicitor_ is a standalone Java (Spring Boot) application. Prerequisite for running it is an existing Java 8 or 11 runtime environment. If you do not yet have a the _Solicitor_ executable JAR (`solicitor.jar`) you need to build it as given on the project GitHub homepage https://github.com/devonfw/solicitor .
_Solicitor_ is a standalone Java (Spring Boot) application. Prerequisite for running it is an existing Java 11 runtime environment. If you do not yet have a the _Solicitor_ executable JAR (`solicitor.jar`) you need to build it as given on the project GitHub homepage https://github.com/devonfw/solicitor .

_Solicitor_ is executed with the following command:

Expand Down Expand Up @@ -1371,6 +1371,7 @@ The following features are deprecated via the above mechanism:
* "REGEX:" prefix notation in rule templates (use "(REGEX)" suffix instead); Stage 1 from Version 1.3.0 on; see https://github.com/devonfw/solicitor/issues/78
* Use of `LicenseAssignmentProject.xls` decision table (use `LicenseAssignmentV2Project.xls` instead); Stage 1 from Version 1.4.0 on
* Use of `repoType` in the configuration of readers, see <<Applications>>; Stage 1 from Version 1.14.0 on; see https://github.com/devonfw/solicitor/issues/190
* Running Solicitor on Java 8; Stage 2 from Version 1.XX.0 on; see https://github.com/devonfw/solicitor/issues/247

== Experimental Scancode Integration

Expand Down Expand Up @@ -1698,9 +1699,13 @@ Spring beans implementing this interface will be called at certain points in the

[appendix]
== Release Notes
Changes in 1.XX.0::
* https://github.com/devonfw/solicitor/issues/247: Running Solicitor on Java 8 is deprecated. (Stage 2 which means that by default Solicitor will abort when being run on Java 8.) See <<Feature Deprecation>> how to temporarily reactivate Java 8 support. Move to Java 11 ASAP!

Changes in 1.22.0::
* https://github.com/devonfw/solicitor/pull/243: Make sure the MavenReader is protected against XXE threats.
* https://github.com/devonfw/solicitor/pull/244: Updated Drools rule engine to 8.44.0.Final.
* https://github.com/devonfw/solicitor/issues/247: Running Solicitor on Java 8 is deprecated (Stage 1) and will be no longer possible soon. Move to Java 11 ASAP!

Changes in 1.21.0::
* https://github.com/devonfw/solicitor/pull/239: Improving some internal components to reduce risk of path traversal attacks in case that these components are (re)used in some webservice implementation.
Expand Down