0

To start, this is a very old code base, currently being compiled/run under Java8. I'm trying to get it compiled/run under OpenJDK 17. So far getting many of the modules to compile, but I'm getting stuck on one of them, which depends on another, asking for the "tests" jar.

The error is Could not find artifact com.findology.f2:biz-lib:jar:tests:1.3-SNAPSHOT

In the local ~/.m2/repository repository, I do see biz-lib-1.3-SNAPSHOT-tests.jar file, so really not sure why it's not finding it.

I'm building the module WAR module with mvn clean install -Dmaven.test.skip=true -DfailIfNoTests=false, but despite that it still keeps giving me that error.

I've tried adding the following to the dependency, but hasn't made a difference

<scope>compile</scope>
<type>jar</type>

I'm using Maven v3.8.5, OpenJDK v17.0.5 on KDE Neon (Ubuntu 22.04 based

EDIT: My dependency entry looks like

<dependency>
   <groupId>com.findology.f2</groupId>
   <artifactId>biz-lib</artifactId>
   <version>${f2.version}</version>
</dependency>
Drizzt321
  • 993
  • 13
  • 27
  • Does the dependency have the `tests` specified? Looks quite useless to configure the `compile` scope as this is the default value, when you want to ignore it with the tests, you rather should add it to the `test` scope – cyberbrain Feb 22 '23 at 20:27
  • @cyberbrain nope, no `` tags. I was just trying out some auto-complete options just in case. Any other ideas to try? – Drizzt321 Feb 22 '23 at 21:04
  • Is the `tests:1.3-SNAPSHOT` defined by one of your own builds? Does that exist in your repository manager ? Might it be deleted in the meantime (many repo manager have cleanup strategies for SNAPSHOT's in place)... ? can show the full pom file? Alos the logging output... – khmarbaise Feb 22 '23 at 22:35
  • what value has `${f2.version}` ? you can find out with `mvn help:effective-pom` what the effective version of this dependency is - Is there a possibility that the version is defined as something different than "1.3-SNAPSHOT"? – cyberbrain Mar 01 '23 at 06:58

1 Answers1

0

The filename biz-lib-1.3-SNAPSHOT-tests.jar can be referenced in two ways as dependency (see the last part of the section But where do I set Artifact extension? as explanation):

<dependency>
  <groupId>com.findology.f2</groupId>
  <artifactId>biz-lib</artifactId>
  <version>1.3-SNAPSHOT</version>
  <classifier>tests</classifier>
</dependency>

or

<dependency>
  <groupId>com.findology.f2</groupId>
  <artifactId>biz-lib</artifactId>
  <version>1.3-SNAPSHOT</version>
  <type>test-jar</type>
</dependency>

To exclude it, you have either to get rid of that dependency, or add <scope>test</scope> to it (that it should have anyways, because tests shouldn't go into a production build), so it is ignored when you skip the tests. If that doesn't help, you can also make it an optional dependency with the addition of <optional>true</optional> to the dependency.

cyberbrain
  • 3,433
  • 1
  • 12
  • 22
  • I've updated to include the dependency entry. I _don't_ want the `test` jar include, that's the problem. And I have tried that `` element, and that didn't make any difference. – Drizzt321 Feb 24 '23 at 17:56
  • So previously the error was shown although you didn't have this dependency declared in your pom.xml? Did you check if it is a transitive dependency? To check it, you could read https://stackoverflow.com/a/6110881/2846138 – cyberbrain Feb 26 '23 at 16:43
  • The "-test" wasn't included, the `biz-lib` dependency was. – Drizzt321 Feb 28 '23 at 19:24