Eclipse and pom files

Hello,
I’m trying to move from writing ImageJ 1.x plugins to ImageJ2 but I’m having real problems getting my IDE (Eclipse) to work with the pom.xml file. I cloned the imagej example command from GitHub and followed the ReadMe file but I cannot get net.imageJ to work from the pom. I’ve checked https://maven.scijava.org for the correct groupID etc but Eclipse reports it as not resolvable in the .java file.
This is how I have the dependency in the pom.xml

net.imagej
ij
1.52u

When I build the project the pom file also shows an error which is as follows:
Failed to execute goal on project e[36mGaussFilteringe[m: e[1;31mCould not resolve dependencies for project com.mycompany:GaussFiltering:jar:0.1.0-SNAPSHOT: Could not transfer artifact net.imagej:imagej:jar:1.52u from/to scijava.public (https://maven.scijava.org/content/groups/public): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targete[m (org.scijava:scijava-maven-plugin:1.1.1:eclipse-helper:default:process-classes)

It looks like net.imagej is the problem but I can’t see where I’m going wrong as its a working example on Github and every other tutorial I’ve looked at declares the dependency in the same way. Totally baffled, I wasn’t expecting problems this quickly in my switch over but any help would be greatly appreciated.

Regards

David

Hi David (@dkelly604),

Welcome to the forum.

Some follow up questions below, but before getting to those, have you tried the following:

  1. After importing the project into eclipse, find the file GausFiltering.java and open it with eclipse.
  2. Run it. with Run > Run from the menu.
  3. Hopefully you observe an ImageJ window pop up, along with a file selection dialog.

If that doesn’t work there’s more troubleshooting to do.

John

Follow up questions

I cloned the imagej example command

This is what you cloned right?

How do you do this exactly?

Hello John

Thanks for responding. I tried to run GaussFiltering.java but I got this error

Error: Could not find or load main class com.mycompany.imagej.GaussFiltering

I think this gets to the root of my confusion as I’m confused about whether I need to use my github account (ie com.github.username). Is the pom.xml designed to work as it is, straight from github which is what I expected as I assumed the com.mycompany was
used to identify who wrote the plugin and all the real work is done by the dependencies and repositories. I’ve tried using my com.github.username account but that also failed.

I did clone imagej/example-imagej-command

Its possible that build was the wrong word, when I make a change to the pom.xml in eclipse, I try 2 methods to update.

Method 1 Right click on project, select Maven and Update Project

Method 2 Right click on project, select Run As, Maven build…

In the dialogue box I put -U clean install into the goals box and then run it.

Both of these methods appear to force Eclipse to try and download the dependencies but it seems to fail with net.imagej, which I guess is why I don’t get an instance of ImageJ when I try to run the plugin.

Regards

David

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

Hi David,

Eclipse should build the project automatically after you import it (provided everything went as it should).
The error you’re getting suggests that eclipse could not build/compile the example.

Regarding some of your questions:

It doesn’t matter.

Does it show any other different errors?

Yes, it should work straight away. i.e. it can work without making an changes to anything.

Other questions and ideas:

  • What OS are you using?
  • Do any other errors show up in the “Problems” tab in eclipse before you try to build? See below:
  • When you open the pom.xml, are there any errors

John

Hello John

I’m running Win 7 at the moment.

I had a look at the eclipse problems tab which I’ve attached.

I’ve also attached a copy of my pom as an rtf file as it won’t send as xml

I appreciate you looking at this as I’ve been stuck on it for a week now.

Thanks

David

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

(Attachment pom.rtf is missing)

1 Like

Hello John

I’ve attached my pom file as a .zip

Regards

David

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

pom.zip (1.18 KB)

1 Like

I’ll have a look shortly

Sorry to hear that : (,
but glad you decided to post here, we’ll get this sorted…

Hi again David (@dkelly604),

I think I have a quick fix for you. Can you try it, and if it works I’ll explain what’s going on.

Change the <dependencies> section of your pom to:

	<dependencies>
		<dependency>
			<groupId>net.imagej</groupId>
  			<artifactId>imagej</artifactId>
		</dependency>
		<dependency>
  			<groupId>net.imglib2</groupId>
  			<artifactId>imglib2</artifactId>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
  			<artifactId>scijava-common</artifactId>
		</dependency>
	</dependencies>

(i.e. remove the version tags)

John

Hello John

No good, removed the warnings but I still get the same 10 errors.

Regards

David

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

That’s weird. Other ideas:

John

I’ve reverted the pom to the original but it makes the problem worse as Scijava and imglib now give errors. Build automatically was already selected.

I can see the website but I’m not sure its correct, I’ve attached a screen shot

I’ve reinstalled Eclipse twice and completely erased the workspace but thats not helped either. Its really odd.

Thanks

David

Thanks for trying this stuff.

Perfect, looks good.

Maybe try from scratch - delete the project in eclipse, re-clone the repo and re-import it into eclipse.
If you get errors in eclipse after this, please post them.

John

The reason I ask this is that there’s no imglib2 (directly) required for that project

I deleted and recloned the project and it failed again, net.imagej still seems to be the problem. I’ve attached a txt file with all the errors

Thanks

David

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

errors.txt (24.3 KB)

Hello John

Just for information, I managed to get to a different computer over the weekend which runs Win 10 and the plugin worked perfectly with no problems. So as Win 7 is at the end of its life and the problem was particularly annoying my feeling is just leave it now
that I’ve got it working easily on Win 10. Thanks for reponding and making the effort to help.

Thanks

David

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

Hi David,

Glad to hear things are better on that win10 machine.
Sorry we couldn’t get it working on the win7 machine though, very strange.

John