Resolving Ivy dependencies for a foundation library in a platform

#1

Hello,

I am having trouble resolving ivy dependencies from a foundation library that was built in another workspace then included in my platform. Is this possible? If so, could you tell me what I’m doing incorrectly?

Thank you,
Lyle

In one workspace:

In another workspace:

  • I have a platform and standalone application.
  • I added the javaAPIs, javaLibs, mocks, scripts from the foundation library to the platform dropins/ folder.
  • I build the platform.
  • I verified the correct files were in the generated platform project.
  • I added the following line to the application’s ivy file:

I get the following Ivy error:

Some projects fail to be resolved
Impossible to resolve dependencies of ep#demo-suite;0.1.0
unresolved dependency: ep.api#foundation;...: not found

In the Ivy console, I see:

:: problems summary ::
:::: WARNINGS
		module not found: ep.api#foundation;+

	==== microEJCentral: tried

	  https://developer.microej.com/4.1/ivy/artifacts/ep/api/foundation//[revision]/ivy-[revision].xml

	  -- artifact ep.api#foundation;+!foundation.jar:

	  https://developer.microej.com/4.1/ivy/artifacts/ep/api/foundation//[revision]/foundation-[revision].jar

	==== microEJLocal: tried

	  C:\Users\llangpap\.ivy2\repository\ep/api\foundation\\[revision]\ivy-[revision].xml

	  -- artifact ep.api#foundation;+!foundation.jar:

	  C:\Users\llangpap\.ivy2\repository\ep/api\foundation\\[revision]\foundation-[revision].jar

		::::::::::::::::::::::::::::::::::::::::::::::

		::          UNRESOLVED DEPENDENCIES         ::

		::::::::::::::::::::::::::::::::::::::::::::::

		:: ep.api#foundation;+: not found

		::::::::::::::::::::::::::::::::::::::::::::::
#2

Hi @llangpap,

You are trying to resolve :

ep.api#foundation;+

There is no such library in our repository, so the error message is right.
Could you please post here the module.ivy file at the root of the project folder? So that I can take a look.

Best Regards,
Gaëtan for MicroEJ

#3

Hello Gaetan,

Thank you for your response.

You are correct that ‘foundation’ is not a library in the MicroEJ repository. It is only a foundation library that I have built on my computer, and added to my platform project. For example, in the platform project, I have the file dropins/javaLibs/foundation-1.0.jar.

I think my basic problem is that I don’t know how to use a foundation library that I have created.

Lyle

The module.ivy file from the application is below:

<!--
	Ivy
-->
<ivy-module version="2.0" xmlns:ea="http://www.easyant.org" xmlns:m="http://ant.apache.org/ivy/extra"> 
    <info organisation="ep" module="demo-suite" status="integration" revision="0.1.0">
        <ea:build organisation="com.is2t.easyant.buildtypes" module="build-firmware-singleapp" revision="1.+">
        	<ea:property name="application.main.class" value="ep.demo.Main" />
        	<!--
        		Use property 'platform-loader.target.platform.dir' to set the platform to use. or uncomment the platform dependency (see below).
        		<ea:property name="platform-loader.target.platform.dir" value="[path-to-local-platform]" />
        	-->
        </ea:build>
    </info>
    
    <configurations defaultconfmapping="default->default;provided->provided;vdruntime->default">
		<conf name="default" visibility="public" description="Runtime dependencies to other artifacts"/>
		<conf name="provided" visibility="public" description="Compile-time dependencies to APIs provided by the platform"/>
		<conf name="vdruntime" visibility="public" description="Dependency needed only by the the player"/>
		<conf name="platform" visibility="public" description="Build-time dependency, specify the platform to use"/>
		<conf name="documentation" visibility="public" description="Documentation related to the artifact (javadoc, PDF)"/>
		<conf name="source" visibility="public" description="Source code"/>
		<conf name="dist" visibility="public" description="Contains extra files like README.md, licenses"/>
 		<conf name="test" visibility="private" description="Dependencies for test execution. It is not required for normal use of the application, and is only available for the test compilation and execution phases."/>
	</configurations>
    
    <publications>
    	<!-- keep this empty if no specific artifact to publish -->
		<!-- must be here in order to avoid all configurations for the default artifact -->
    </publications>
    
    <dependencies>
    	<!-- 
			Put MicroEJ API dependencies to the "provided->*" configuration
			Other regular runtime dependencies are in the "default,provided" configuration  
		-->
        <dependency org="ej.api" name="edc" rev="[1.2.0-RC0,2.0.0-RC0[" conf="provided->*" />
		<dependency org="ej.api" name="bon" rev="[1.2.0,1.3.0[" conf="provided->*" />
		<dependency org="ej.api" name="ecom" rev="[1.1.0,1.2.0[" conf="provided->*" />
		<dependency org="ej.api" name="ecom-comm" rev="[1.1.0,1.2.0[" conf="provided->*" />
		<dependency org="ej.library.test" name="junit" rev="[1.0.0-RC0,2.0.0-RC0[" conf="test->*" />
        <dependency org="ep.api" name="foundation" rev="+" conf="provided->*" />
        <!-- Platform -->
        <!--
       		<dependency org="com.is2t.CM7.referencePlatforms.st" name="STM32F746GDISCO-846SI" rev="[3.0.0-RC0,4.0.0-RC0[" conf="platform->platformDev" transitive="false"/>
   		-->
    </dependencies>
</ivy-module>
#4

Ok your dependency as far as I can analyze seems to be properly expressed. The configuration provided is telling the dependency resolution to go look for the API in the one of the repository (then at launch it is matched against the implementation in the platform).

Here the dependency resolution fails to find the API dependency in our repository and also in your cache.

Could you check in your ivy cache if there is the corresponding API (in C:\Users\llangpap\.ivy2\repository\)?
The API should have been published in your cache during the step:

I build the API, impl, and mock projects with EasyAnt.

So can you also check if the build of the API is correctly publishing in your Ivy cache (you should have publication traces in the Console view)?

Regards,
Gaëtan

#5

Hi Gaetan,

You correctly identified the immediate problem. I fixed the dependency error with the following steps:

  • I rebuilt the foundation library projects with EasyAnt
  • I verified the correct files were in my local ivy cache
  • I unzipped the artifacts for each project
  • I added the artifact’s contents to the dropins/ folder of my platform
  • I built the platform

I ran into another problem when trying to Build & Deploy the standalone application. When I click Run for the application’s Run Configuration, I get the following message:

MyDevice-MyName-CM7hardfp_GCC48 does not provide implementation for:
 - FOUNDATION-0.1.0-RC201904191145 (referenced by project Standalone-DemonstrationSuite)

Proceed with launch?

Do you have any suggestions to resolve this error?

Thank you,
Lyle

#6

Here we are at the step where the API library and the implementation added in the platform should match, unfortunately it didn’t.

Could you please check if the Ivy resolved API library (you can find it in the Ivy container displayed at the root of the project folder) is matching with the one in your platform exactly (same RC version as the one in ${platform_dir}/source/javaLibs directory)?

Gaëtan

#7

Hi Gaetan,

They are not exactly the same. RC201904191145 vs. RC201904191146. Why would they be different? The same project placed the jar in the ivy cache and created the target~/artifacts/ files, right?

Under Ivy/ in the root of the project folder, I have:

foundation-0.1.0-RC201904191145.jar - C:\Users\llangpap\.ivy2\cache\ep.api\foundation\jars

When I unzip foundation-1.0.jar from source/javaLibs/, it has the following in META-INF/version.properties:

#Generated by easyant
#Fri, 19 Apr 2019 11:46:22 -0300

APPLICATION-NAME=foundation
SPEC-VERSION=0.1.0
APPLICATION_ORG=ep.impl
VERSION=0.1.0-RC201904191146
DATE=2019/04/19 11\:46

Lyle

#8

Even with the same version, I still get an error. Am I adding the files to the platform correctly?
Lyle

MyDevice-MyName-CM7hardfp_GCC48 does not provide implementation for:
 - FOUNDATION-0.1.0-RC201904230833 (referenced by project Standalone-DemonstrationSuite)

Proceed with launch?
#Generated by easyant
#Tue, 23 Apr 2019 08:33:57 -0300

APPLICATION-NAME=foundation
SPEC-VERSION=0.1.0
APPLICATION_ORG=ep.impl
VERSION=0.1.0-RC201904230833
DATE=2019/04/23 08\:33
#9

Hi @llangpap,

In a previous message you talk about a foundation-1.0.jar, you should have a foundation-0.1.0.jar, was it a misprint or is that the case? It could cause the mismatch.

Gaëtan

#10

Well…that’s embarrassing. The ivy file had a different version for microej.lib.name and revision. I corrected the version, and now everything works!

Thank you, Gaetan.

Lyle