Missing artifact in vaadin start project (maven issue) - eclipse

I was just about to get started with the vaadin start project (https://start.vaadin.com/). I downloaded it and imported it into eclipse. However after that I got a Maven import error on line 112+ telling me there is a "Missing artifact org.vaadin.artur:a-vaadin-helper:jar:1.5.0"
<dependency>
<groupId>org.vaadin.artur</groupId>
<artifactId>a-vaadin-helper</artifactId>
<version>1.5.0</version>
</dependency>
All other dependencies can be resolved. I do not have a custom settings.xml for maven. Refreshing does not help.

The artifact is located in the Vaadin Addons repository (for which there is a definition in the pom.xml). Perhaps you are using a Maven proxy that does not include this repository?

Related

Circular Dependencies in Eclipse Platform

I'm trying to add the Eclipse Platform to my Maven project and stumbled over something very weird.
There is the plug-in org.eclipse.swt, which has a dependency org.eclipse.swt.${osgi.platform}, where ${osgi.platform} can be any of the following:
cocoa.macosc.cocoa
gtk.linux.aarch64
win32.win32.x86_64
However if you check the pom.xml of org.eclipse.swt.win32.win32.x86_64 you learn that this project has a dependency to org.eclipse.swt. Which forms a nice dependency circle, which is not allowed in Maven nor in OSGi.
Consequently I'm getting a StackOverflowError, but only if I try to use the maven-dependency-plugin with -Dosgi.platform=win32.win32.x86_64.
If I don't use that parameter I get the following exception:
No versions available for org.eclipse.platform:org.eclipse.swt.gtk.linux.aarch64:jar:[3.105.2,3.105.2]
(Which is probably okay, because I guess that Linux is the default value, but it doesn't apply to me, since I've got a Windows PC.)
I can't exclude the dependency either, e.g. with:
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.swt</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.swt.gtk.linux.aarch64</artifactId>
</exclusion>
</exclusions>
</dependency>
I get the same error messages as above with that approach.
I'm wondering how the Eclipse guys even managed to release that mess, but more importantly: How do I build against a Maven project with circular dependencies like this?
You're looking at the wrong place. Eclipse artifacts are published in Eclipse p2 repositories. In addition, some Eclipse artifacts will be published in Maven repositories for use in plain (non-Eclipse based) Java applications which cannot be used to build Eclipse-based applications. Something seems to have gone wrong publishing Eclipse SWT to Maven Central causing the circular dependencies. Please report this to Eclipse.
The Eclipse IDE packages are built with the Maven plug-in Tycho. See for example the pom.xml file for the Eclipse platform or here the parent pom.xml for all IDE packages. Tycho uses one or more Eclipse p2 repositories to resolve dependencies. A Maven repository would not work to resolve Import-Package dependencies or product configurations, for example. In a Maven repository, an artifact has a version, while in a p2 repository also Java packages of the same JAR can have different versions. In a Maven Tycho pom.xml only the p2 repositories have to be specified, the dependencies are already declared in the META-INF/MANIFEST.MF, feature.xml and *.product files.

eclipse cannot find the jar available in maven dependencies

I have a pom.xml with the following entry
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
And on maven install the jar is added to the maven repository and is also listed in the maven dependencies library.
But I am not able to import any of the classes from the added jar 'spring-web-3.1.0.RELEASE.jar' for the particular entry, though it shows in the classpath
The error - in eclipse "cannot be resolved to a type"
environment - maven 3.1 and Spring tool suite
Thanks
Solved - found the solution through some other forum
The jar inside the repository was corrupted.
After clearing the .m2 folder in the physical drive and repeating the maven clean install worked.
Thanks for the time #techidiot #jtravaglini.

eclipse buildpath error with maven dependency

In my pom.xml i have the following dependency
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.8</version>
</dependency>
My eclipse download the jar file as expected and my code compiles just fine. But when i execute my JUnit tests i'm gettin a exception wich is the cenario expected for when the dependency is missing.
If i change the dependency to
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.8</version>
<scope>system</scope>
<systemPath>\path\to\wstx-asl-3.2.8.jar</systemPath>
</dependency>
the issue persists. But when i remove the dependency from the pom.xml and add it to the builpath using the standard eclipse way everything works just fine.
Executing a mvn package the tests are executed just fine. Only when i run them in the eclipse envirionment that the issue occurs.
what am i missing here?
Eclipse has a separate build path. When using maven projects within Eclipse you need to rebuild the build path that Eclipse uses to point to the downloaded Maven artifacts.
You do this by running mvn eclipse:eclipse on your project and then clean and build your project from within eclipse.
This Maven plugin rebuilds your .classpath file within your project, this file stores your build path.
See: http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html

Eclipse Project with Dependency Management by Maven

I have a Eclipse project where Maven manages the dependencies. I have also few jar files that are not Maven enable and I locate them at src/main/webapp/WEB-INF/lib. I have no issue to build/run the project in Eclipse. I have no issue also to run "mvn:package" after I built the project in Eclipse. However, after I invoke "mvn:clean", if I run "mvn:package", I will get compilation error as it can't find dependency jar files under src/main/webapp/WEB-INF/lib. What I need to do is to rebuild the Eclipse project then "mvn:package". Therefore, I can't invoke "mvn:package" outside Eclipse IDE.
How to resolve this?
Thanks.
You have to put the not "Maven enabled artifacts" to an appropriate Maven Repository (Nexus, Artifactory what ever) and than change your project to use the dependencies appropriately. Furthermore either you do Maven or not but nothing in between. Maven is a build tool and not only for dependency management. After those changes working with Eclipse will work fine (if you use M2Eclipse). If you correctly use Maven you can do both things via Eclipse or call mvn package on command line.
If you can not set up a recommended environment (maven repository) you can add the dependencies as System dependencies to your pom.xml.
<project>
...
<dependencies>
<dependency>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.2.3</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/foobar.jar</systemPath>
</dependency>
</dependencies>
...
</project>

Adding dependencies in Maven Netbeans

I've created a Maven project and added the dependencies (jar files) that I need; however, netbeans says that it still cannot find it.
Specifically in my case, I added the jmf-2.1.1e.jar file into my dependencies folder. When I go back to my program it still gives me the compile error that it cannot find the javax.media package.
Did you let Netbeans manage the dependency?
In your "Projects" listing, find and context+click on the "Dependencies" folder in the list. From the context menu, choose "Add Dependency".
This approach works at least in NetBeans 7.4 and 8.0 beta.
Make sure that your pom.xml has the following snippet that defines the dependency
<dependencies>
<dependency>
<groupId>javax.media</groupId>
<artifactId>jmf</artifactId>
<version>2.1.1e</version>
</dependency>
</dependencies>
The dependency is available in Maven Central. Add the pom snippet manually to the pom.xml and run Maven in the shell and let it download the dependency. This should resolve your issue.
Maven automatically downloads the dependency once specified in the pom.xml. For this you would have to build your project with the dependency as specified by Tim Sparg.