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

EOL tracking with release date of current dependency version #267 #268

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

neifach
Copy link

@neifach neifach commented Sep 4, 2024

See #267

@@ -1212,6 +1216,74 @@ public void projectExceedsMaxLibYearsAndShouldFailTheBuild() throws Exception {
l.contains("This module exceeds the maximum" + " dependency age of 0.1 libyears")));
}

@Test
public void reportFileGenerated(@TempDir Path tempDir) throws Exception {
Path reportFile = tempDir.resolve("libyear_testreport.txt");
Copy link
Owner

@mfoo mfoo Sep 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the plugin doesn't write any of the libyear findings to a file for outdated dependencies. What's the motivation for adding it here? To me it feels like something that should be everywhere or nowhere, I.e we should implement it everywhere else that we're logging currently. Both for things that are outdated and things that are possibly abandoned?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would use the plugin for the asynchronous builds via Jenkins. Analyzing the log files is tedious; We need a file in which we can look up the results at any time and which we could also send to other project participants. And yes, I also think this can be useful for all expenses. Control is possible via a configuration parameter: either all results are written to a file or to the log output.

* otherwise only dependencies older than the specified number of years will be included.
*/
@Parameter(property = "minLibYearsForReport", defaultValue = "0.0")
private float minLibYearsForReport;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add a test for this setting?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test "reportFileGenerated" is also the test for minLibYearsForReport. It is checked that not all outdated dependencies end up in the report. Should I write another separate test? What exactly should the test case be?

Path path = Paths.get(reportFile);

try {
Files.write(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I run this on a multi-module project, with a path that would resolve the same for multiple projects (e.g. /tmp/foo.txt or ../foo.txt, will the last one overwrite all of the previous ones?

Are there any concurrency issues if this was done in parallel?

Example parameters: -DreportFile=/tmp/foo.txt -T2C.

Would it be simpler to replace the text file writing here with log output, and to solve the file problem globally (separately)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion it shouldn't be a problem. The report is written in append mode.

@mfoo
Copy link
Owner

mfoo commented Sep 15, 2024

Using the following:

$ mvn io.github.mfoo:libyear-maven-plugin:1.1.1-SNAPSHOT:analyze -DreportFile=target/dave.txt -DminLibYearsForReport=2

I can see the following output:

$ cat target/dave.txt 
All dependencies older than 2.0 libyears:

javax.inject:javax.inject: 1 ............................ 14.96 libyears
org.apache.maven:maven-project: 2.2.1 ................... 15.15 libyears
org.apache.maven.plugin-testing:maven-plugin-testing-harness: 3.3.0 
  ........................................................ 9.77 libyears
org.eclipse.aether:aether-api: 1.1.0 ..................... 8.63 libyears

But the output of the plugin itself shows this:

INFO] ----------------< io.github.mfoo:libyear-maven-plugin >-----------------
[INFO] Building libyear-maven-plugin Maven Mojo 1.1.1-SNAPSHOT
[INFO] ----------------------------[ maven-plugin ]----------------------------
[INFO] 
[INFO] --- libyear-maven-plugin:1.1.1-SNAPSHOT:analyze (default-cli) @ libyear-maven-plugin ---
[INFO] The following dependencies in Dependencies have newer versions:
<snip>
[INFO]   org.apache.maven.plugin-testing:maven-plugin-testing-harness 
[INFO]   ........................................................ 9.56 libyears
<snip>

Am I reading this wrong? It seems to suggest that the version in this project is 9.56 libyears behind but the latest version hasn't been updated in 9.77 years - which doesn't sound right.

| Option | Description | Format |
|----------------------|-------------------------------------------------------------|---------------------------------|
| `dependencyExcludes` | Ignore certain dependencies | `io.github.mfoo:*,org.apache:*` |
| `maxLibYears` | Cause the build to fail if dependencies are older than this | `4` |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this maxLibYears setting interact with the years-without-new-update setting?

E.g, it might make sense to cause failures if either any dependency is more than X years behind the latest or if it hasn't been updated in X years.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want the build to fail, we just need the information about how old the dependencies are and actually in one file.

@neifach
Copy link
Author

neifach commented Oct 1, 2024

And regarding your comment: There is a newer version of "maven-plugin-testing-harness" that is 9.56 libyears younger than the one used, but the version used is 9.77 libyears old. That's not a contradiction for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants