I have an model module in my project, which follows parser in the pom.
Both have eclipse-plugin as packaging.
parser generates an artifact inez-parser-<version>-testing.jar, which is deployed to the model module using maven-dependency-plugin:copy-dependencies in the initialize phase, so I do have model/target/dependency/inez-parser-testing.jar.
However in the testCompile phase at the first run of mvn install I get the following error:
[ERROR] /home/mag/project/KodeKonveyor/inez-server/model/src/test/java/io/github/magwas/inez/BridiTestData.java:[10]
[ERROR] public interface BridiTestData extends BridiElementTestData {
[ERROR] ^^^^^^^^^^^^^
[ERROR] The hierarchy of the type BridiTestData is inconsistent
BridiTestData transitively imports a class which is in inez-parser-testing.jar.
my model/.classpath is:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="target/classes" sourcepath="target/classes"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="lib" path="target/dependency/mockito-core.jar"/>
<classpathentry kind="lib" path="target/dependency/junit-jupiter-api.jar"/>
<classpathentry kind="lib" path="target/dependency/junit-jupiter-engine.jar"/>
<classpathentry kind="lib" path="target/dependency/junit-platform-commons.jar"/>
<classpathentry kind="lib" path="target/dependency/junit-platform-engine.jar"/>
<classpathentry kind="lib" path="target/dependency/junit-platform-launcher.jar"/>
<classpathentry kind="lib" path="target/dependency/konveyor-base-testing.jar"/>
<classpathentry kind="lib" path="target/dependency/inez-parser-testing.jar"/>
<classpathentry kind="lib" path="target/dependency/spring-test.jar"/>
</classpath>
If the line <classpathentry kind="lib" path="target/dependency/inez-parser-testing.jar"/> is not in the classpath, every run of mvn install causes the above error.
With it, the second run yields another error:
[ERROR] /home/mag/project/KodeKonveyor/inez-server/model/src/test/java/io/github/magwas/inez/element/BridiElementEndToEndTest.java:[20]
[ERROR] import io.github.magwas.inez.TestConfig;
My theory is that all dependencies are considered in the target platform configuration in the very beginning of the build, and at that time the jar file is not there in the first run. I do not know if it is the case, and I do not see how to declare that dependency in time.
Which is interesting, because I do have it compiled:
$ find |grep TestConfig
./model/src/test/java/io/github/magwas/inez/TestConfig.java
./model/target/test-classes/io/github/magwas/inez/TestConfig.class
After a clean, if I cd model;mvn install, it compiles without error (though tests do not run).
I am using maven version 3.9.11 because I had to upgrade to tycho version 4.0.12 to correctly resolve the target platform. I swear that it was working with maven 3.8.7 and tycho 3.0.5, even tests ran fine.
model/build.properties:
bin.includes = META-INF/,\
plugin.xml,\
.
output.. = target/classes/
source.. = src/main/java
model/META-INF/MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Main-Class: io.github.magwas.inez.Main
Bundle-Name: inez-model
Bundle-SymbolicName: inez-model;singleton:=true
Spring-Context: *;create-asynchronously:=false
Bundle-Activator: io.github.magwas.inez.osgi.SpringBootBundleActivator
Bundle-Version: 0.4.5
Bundle-Vendor: Árpád Magosányi
Export-Package: io.github.magwas.inez,
io.github.magwas.inez.element,
io.github.magwas.inez.osgi
Require-Bundle: wrapped.org.springframework.boot.spring-boot;bundle-version="3.5.3",
wrapped.org.springframework.boot.spring-boot-autoconfigure;bundle-version="3.5.3",
wrapped.org.springframework.boot.spring-boot-autoconfigure.source;bundle-version="3.5.3",
wrapped.org.springframework.boot.spring-boot.source;bundle-version="3.5.3",
wrapped.org.springframework.data.spring-data-commons;bundle-version="3.5.1",
wrapped.org.springframework.data.spring-data-commons.source;bundle-version="3.5.1",
wrapped.org.springframework.data.spring-data-keyvalue;bundle-version="3.5.1",
wrapped.org.springframework.data.spring-data-keyvalue.source;bundle-version="3.5.1",
wrapped.org.springframework.spring-aop;bundle-version="6.2.8",
wrapped.org.springframework.spring-beans.source;bundle-version="6.2.8",
wrapped.org.springframework.spring-core;bundle-version="6.2.8",
wrapped.org.springframework.spring-core.source;bundle-version="6.2.8",
wrapped.org.springframework.spring-jcl.source;bundle-version="6.2.8",
wrapped.org.springframework.spring-tx;bundle-version="6.2.8",
wrapped.org.springframework.spring-tx.source;bundle-version="6.2.8",
wrapped.org.springframework.spring-beans;bundle-version="6.2.8",
wrapped.org.springframework.spring-context;bundle-version="6.2.8",
wrapped.org.springframework.spring-context.source;bundle-version="6.2.8",
wrapped.io.github.magwas.konveyor-base;bundle-version="0.3.0",
wrapped.io.github.magwas.konveyor-base.source;bundle-version="0.3.0",
org.antlr.antlr4-runtime;bundle-version="4.13.2",
org.antlr.antlr4-runtime.source;bundle-version="4.13.2",
inez-parser,
org.eclipse.core.runtime;bundle-version="3.12.0"
Bundle-RequiredExecutionEnvironment: JavaSE-21
Automatic-Module-Name: io.github.magwas.inez.model
Bundle-ClassPath: .,
target/classes
What should I do to make the module compile and test at the first time as part of the full build?
Bundle-ClassPath: ., target/classesyou found your own way to do that which seems more difficult to do and to maintain.