Local dependencies in pom for fiji plugins

Hi Guys, @ctrueden

I have a question: If I have a local dependency like this in my pom:

<dependency>
    <groupId>com.github.tischi</groupId>
    <artifactId>fiji-plugin-bigDataTools</artifactId>
    <version>0.5.5</version>
    <scope>system</scope>
    <systemPath>/Applications/Fiji.app/plugins/fiji_plugin_bigDataTools-0.5.5.jar</systemPath>
</dependency>

Will this work on my Update site? Is this recommended?

fiji_plugin_bigDataTools-0.5.5.jar is in principle available to Fiji because it is also part of my update site.

I guess, in other words I am asking:
Is the information in the pom still used after I build my jar?
Or is the jar just assuming that the dependencies are somewhere present in the Fiji folder?

Best,
Christian

3 Likes

Hey @Christian_Tischer,

it will work with your update site if you upload the mentioned JAR file in the right version to the update site as well. In other words: It will work if the mentioned JAR file exists in the plugin or jar directory of Fiji.

The pom file is actually just taken into account while building your JAR file. In case you are collaborating with somebody on a project, he or she might have a hard time with hard coded folder locations, because he might have to have the same JAR file in the same folder.

As an alternative, I can recommend getting a profile on bintray.com and uploading your common.jar files to this world-wide reachable maven repository. It’s quite easy and keeps you independent. In order to make this work, you need to add an entry to the pom file of the thing you want to reuse, e.g. (copied from here):

<distributionManagement>
	<repository>
		<id>bintray-haesleinhuepf-snapshots</id>
		<name>bintray-snapshots</name>
		<url>https://api.bintray.com/maven/haesleinhuepf/snapshots/clearclij/;publish=1</url>
	</repository>
</distributionManagement>

Your dependent pom file need to know the link to the bintray repository, e.g.:

<repository>
	<id>hslh</id>
	<url>http://dl.bintray.com/haesleinhuepf/snapshots</url>
</repository>

Cheers,
Robert

6 Likes

Wow, that looks super useful, indeed! Thank you very much!

1 Like

Do I have to do anything here?

I added this to my pom.xml; should I be able to somehow see it on bintray?

    <distributionManagement>
        <repository>
            <id>bintray-embl-cba-snapshots</id>
            <name>bintray-snapshots</name>
            <url>https://api.bintray.com/maven/embl-cba/snapshots/clearclij/;publish=1</url>
        </repository>
    </distributionManagement>

Also, after maven install the maven log does not mention “bintray”…

Hi Christian,

you need to Add New Repository “snapshots”. Furthermore, you may have to create a package within this repository. In this case, “clearclij”. Don’t be afraid, you can delete stuff after testing :wink:

Cheers,
Robert

1 Like

thanks. better…but still something wrong :slight_smile:

btw: i think one needs to do maven deploy rather than maven install, right?

    <distributionManagement>
        <repository>
            <id>bintray-embl-cba-snapshots</id>
            <name>bintray-snapshots</name>
            <url>https://api.bintray.com/maven/embl-cba/snapshots/fiji-plugin-bigDataTools/;publish=1</url>
        </repository>
    </distributionManagement>

[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ fiji_plugin_bigDataTools ---
Uploading: https://api.bintray.com/maven/embl-cba/snapshots/fiji-plugin-bigDataTools/;publish=1/de/embl/cba/fiji_plugin_bigDataTools/0.5.51/fiji_plugin_bigDataTools-0.5.51.jar
Uploading: https://api.bintray.com/maven/embl-cba/snapshots/fiji-plugin-bigDataTools/;publish=1/de/embl/cba/fiji_plugin_bigDataTools/0.5.51/fiji_plugin_bigDataTools-0.5.51.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.589 s
[INFO] Finished at: 2018-07-31T12:01:00+02:00
[INFO] Final Memory: 44M/503M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project fiji_plugin_bigDataTools: Failed to deploy artifacts: Could not transfer artifact de.embl.cba:fiji_plugin_bigDataTools:jar:0.5.51 from/to bintray-embl-cba-snapshots (https://api.bintray.com/maven/embl-cba/snapshots/fiji-plugin-bigDataTools/;publish=1): Failed to transfer file: https://api.bintray.com/maven/embl-cba/snapshots/fiji-plugin-bigDataTools/;publish=1/de/embl/cba/fiji_plugin_bigDataTools/0.5.51/fiji_plugin_bigDataTools-0.5.51.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
[ERROR] 

maybe the snapshots is the issue?

You mixed up “snapshots” and “fiji-plugin-bigDataTools”. Please create a repository “snapshots” in your bintray profile. Within that, create a package “fiji-plugin-bigDataTools”. :wink:

image

I still get an error…

Do you have such a “settings.xml” file?

…and if so, how do you get the “API key”?

1 Like

My settings.xml looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
          xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    
    <profiles>
        <profile>
            <repositories>
                <repository>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                    <id>bintray-haesleinhuepf-snapshots</id>
                    <name>bintray</name>
                    <url>https://dl.bintray.com/haesleinhuepf/snapshots</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                    <id>bintray-haesleinhuepf-snapshots</id>
                    <name>bintray-plugins</name>
                    <url>https://dl.bintray.com/haesleinhuepf/snapshots</url>
                </pluginRepository>
            </pluginRepositories>
            <id>bintray</id>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>bintray</activeProfile>
    </activeProfiles>
	
	<servers>
	<server>
	  <id>bintray-haesleinhuepf-snapshots</id>
	  <username>haesleinhuepf</username>
	  <password>rumpelstilzchen</password>
	</server>
	</servers>
</settings>

And the API key, you get from bintrays user profile page > Edit profile > API Key

Cheers,
Robert

1 Like

OK. thanks! I will try!
Just for other people that may not not either: The settings.xml file needs to go to your ../.m2/ folder.

1 Like

Yeah! First success! Upload worked now!

…and download also worked now.

Thanks a lot!!!

1 Like

…I saw this was a free trial website…Do you know how much does it cost to actually have it?

1 Like

You mean bintray? It’s free for open source projects. Otherwise: https://bintray.com/account/pricing

2 Likes

I tried again with the free open source version.

But it complains

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project bdv-utils: Failed to deploy artifacts: Could not transfer artifact de.embl.cba:bdv-utils:jar:0.1.26 from/to bintray-tischi-snapshots (https://api.bintray.com/maven/tischi/snapshots/bdv-utils/;publish=1): Failed to transfer file: https://api.bintray.com/maven/tischi/snapshots/bdv-utils/;publish=1/de/embl/cba/bdv-utils/0.1.26/bdv-utils-0.1.26.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

I made the package like this, choosing import from github:

The weird thing is that when I downloaded the settings.xml file it was saying

<snapshots>
           <enabled>false</enabled>
</snapshots>

and I manually had to change it to true.

1 Like

Hi @Christian_Tischer,

I think bintray doesn’t support snapshot releases at all.

But your error message actually hints to a not working authorisation. I guess you do have settings.xml in /Users/tischi/.m2 with the right server entry? Is the ID identical to bdv-utils server-ID? Something like this:

<servers>
	<server>
	  <id>bintray-haesleinhuepf-snapshots</id>
	  <username>haesleinhuepf</username>
	  <password>MeinNameIstHaase</password>
	</server>
</servers>

Furthermore, bdv-utils must point to this ID. I’m asking, because this pom
https://github.com/tischi/bdv-utils/blob/master/pom.xml needs to contain something like

<distributionManagement>
	<repository>
		<id>bintray-haesleinhuepf-snapshots</id>
		<name>bintray-snapshots</name>
		<url>https://api.bintray.com/maven/haesleinhuepf/clij/clij_/;publish=1</url>
	</repository>
</distributionManagement>
1 Like

now it works.
I think in the settings.xml the server stuff needs to be outside of the profile stuff.

1 Like