Failed to create maven project in Eclipse Java EE IDE - eclipse

By default, the maven plugin is integrated with the latest Eclipse IDE versions (eg., Mars). However, on creating a Maven project it simply throws the following error:
Note: it doesn't undergo any proxy setup
Could not calculate build plan: Plugin
org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its
dependencies could not be resolved: Failure to find
org.apache.maven.plugins:maven-resources-plugin:jar:2.6 in
http://localhost:8081/nexus/content/groups/public was cached in the
local repository, resolution will not be reattempted until the update
interval of nexus has elapsed or updates are forced Plugin
org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its
dependencies could not be resolved: Failure to find
org.apache.maven.plugins:maven-resources-plugin:jar:2.6 in
http://localhost:8081/nexus/content/groups/public was cached in the
local repository, resolution will not be reattempted until the update
interval of nexus has elapsed or updates are forced
Tool used:
Eclipse Java EE IDE for Web Developers.
Version: Mars Release (4.5.0)

The following xml file did trick for me., to do so..
1| Create an xml file (settings.xml) in the following location,
C:\Users\username\.m2\settings.xml
2| Copy and paste the below xml snippet that contains multiple mirror tags in it.
3| Save the xml file.
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>ibiblio.org</id>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- United States, North Carolina -->
</mirror>
<mirror>
<id>lsu.edu</id>
<url>http://ibiblio.lsu.edu/main/pub/packages/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- United States, Louisiana -->
</mirror>
<mirror>
<id>sateh.com</id>
<url>http://maven.sateh.com/repository</url>
<mirrorOf>central</mirrorOf>
<!-- The Netherlands, Amsterdam -->
</mirror>
<mirror>
<id>dotsrc.org</id>
<url>http://mirrors.dotsrc.org/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- Denmark -->
</mirror>
<mirror>
<id>sunsite.dk</id>
<url>http://mirrors.sunsite.dk/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- Denmark -->
</mirror>
<mirror>
<id>skynet.be</id>
<url>http://maven2.mirrors.skynet.be/pub/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- Belgium -->
</mirror>
<mirror>
<id>cica.es</id>
<url>http://ftp.cica.es/mirrors/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- Spain, Sevilla -->
</mirror>
<mirror>
<id>redv.com</id>
<url>http://mirrors.redv.com/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- Shanghai, China -->
</mirror>
<!-- these just point to ibiblio.org -->
<mirror>
<id>ibiblio.net</id>
<url>http://www.ibiblio.net/pub/packages/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- United States, North Carolina -->
</mirror>
<mirror>
<id>ggi-project.org</id>
<url>http://ftp.ggi-project.org/pub/packages/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- The Netherlands, Amsterdam -->
</mirror>
</mirrors>
<profiles>
<profile>
<id>alwaysActiveProfile</id>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
</activeProfiles>
</settings>
4| Go to, Eclipse > Window > Preferences > Maven > User Settings
5| Check User Settings location

it was disturbing me too but someone gave me this solution and it worked
make sure you are online
Right-click your project
-Click on Maven
-Update project
-Force update snapshots/ Releases
-Ok

Related

How to get source bundles when using tycho-p2-extras to mirror an eclipse p2 repository

I want to create a mirror of an eclipse p2 repository containing the needed ius for building an rcp application. The mirroring did work and the needed bundles are locally stored. I can reference them from my tycho build and from my eclipse ide. It works but the targetdefinition file, containing the folder of the eclipse p2 mirror, complains about the missing source bundles.
I read and tried the switches tycho-p2-extras offers but no switch seems to solve that problem.
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-p2-extras-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>mirror</goal>
</goals>
</execution>
</executions>
<configuration>
<source>
<!-- source repositories to mirror from -->
<!-- supported layouts are "p2-metadata", "p2-artifacts", and "p2"
(for joint repositories; default) -->
<repository>
<id>eclipse-2018-09</id>
<url>http://download.eclipse.org/releases/2018-09</url>
<layout>p2</layout>
</repository>
<repository>
<id>eclipse-2018-09-tech</id>
<url>https://download.eclipse.org/technology/epp/packages/2018-09/</url>
<layout>p2</layout>
</repository>
</source>
<!-- List of IUs to mirror. If omitted, allIUs will be mirrored. -->
<!-- Omitted IU version element means latest version of the IU -->
<ius>
<iu>
<id>org.eclipse.e4.rcp.feature.group</id>
</iu>
<iu>
<id>org.eclipse.emf.common.feature.group</id>
</iu>
<iu>
<id>org.eclipse.emf.ecore.feature.group</id>
</iu>
<iu>
<id>org.eclipse.equinox.executable.feature.group</id>
</iu>
<iu>
<id>org.eclipse.ui.themes</id>
</iu>
<iu>
<id>org.objectweb.asm</id>
</iu>
<iu>
<id>org.eclipse.swt</id>
</iu>
</ius>
<!-- The destination directory to mirror to. -->
<destination>${project.build.directory}/repository</destination>
<!-- Whether only strict dependencies should be followed. -->
<!-- "strict" means perfect version match -->
<followStrictOnly>false</followStrictOnly>
<!-- Whether or not to follow optional requirements. -->
<includeOptional>true</includeOptional>
<!-- Whether or not to follow non-greedy requirements. -->
<includeNonGreedy>true</includeNonGreedy>
<!-- Filter properties. E.g. filter only one platform -->
<!--
<filter>
<osgi.os>win32</osgi.os>
<osgi.ws>win32</osgi.ws>
<osgi.arch>x86_64</osgi.arch>
</filter>
-->
<!-- Whether to filter the resulting set of IUs to only -->
<!-- include the latest version of each IU -->
<latestVersionOnly>false</latestVersionOnly>
<!-- don't mirror artifacts, only metadata -->
<mirrorMetadataOnly>false</mirrorMetadataOnly>
<!-- whether to compress the content.xml/artifacts.xml -->
<compress>false</compress>
<!-- whether to append to the target repository content -->
<append>true</append>
<!-- whether to mirror pack200 artifacts also. Available since tycho-extras
0.17.0 -->
<includePacked>true</includePacked>
</configuration>
</plugin>
</plugins>
</build>
As far as I know, there's no such option in the tycho-p2-extras-plugin:mirror goal, because there's no such option in the Eclipse mirror application on which the plugin relies.
You have to mirror the corresponding source features yourself (which will automatically mirror the related sources of the included bundles).
However, some projects provide features that automatically include all the sources, for example, org.eclipse.emf.sdk.feature.group. You will also mirror all the sources if you mirror such a feature.

Eclipse cannot find dependencies of a plugin built with Maven Tycho

I am using Maven Tycho to compile my projects which are structured like this :
- plugin1
- plugin2 (depends on plugin1)
- plugin3 (depends on plugin1 & 2)
- plugin4 (depends on plugin1)
- plugin5 (depends on plugin1 & 4)
- plugin6 (depends on all previous plugins)
- plugin7 (depends on all previous plugins)
{all these plugins are compiled as eclipse-plugin}
- feature1 (contains all previous plugins) {eclipse-feature}
- updatesite1 {eclipse-repository}
- generalproject (contains only the parent pom)
I compile this via Eclipse (maven install), everything works and i can access my local repository, and install my feature in the same Eclipse (through "Install new software").
The problem is when i try to install my feature to another instance of Eclipse, which refuse to install it with the error :
(Missing requirement: Acceleo Texts Module IDE Plug-in 1.0.0.201612161812 (myproject.acceleo.ui 1.0.0.201612161812) requires 'bundle org.eclipse.ocl 0.0.0' but it could not be found)
I know that this is a non satisfied requirement problem, but in Eclipse i checked "Contact all update sites during install to find required software", and my pom declares repositories containing all requirements, here is my parent pom :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>myproject.project</groupId>
<artifactId>myproject.general</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<tycho.version>0.23.0</tycho.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>Mars</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/mars/</url>
</repository>
<repository>
<id>Sirius</id>
<layout>p2</layout>
<url>http://download.eclipse.org/sirius/updates/releases/4.1.2/mars/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<!-- enable tycho build extension -->
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<!-- enable tycho build extension -->
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>i386</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>../myproject</module>
<module>../myproject.acceleo</module>
<module>../myproject.acceleo.ui</module>
<module>../myproject.design</module>
<module>../myproject.edit</module>
<module>../myproject.editor</module>
<module>../myproject.plugin</module>
<module>../myproject.project</module>
<module>../myproject.site</module>
</modules>
</project>
I cannot figure how to resolve this ? did i omit something in my procedure ?
Thank you.
I fell for the same thing. Tycho does not include all dependencies, even though that's normal and desired maven behaviour. As maven does not "see" tycho (so manifest-derived) dependencies, they are not included.
You can override this behaviour by setting to true:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<includeAllDependencies>true</includeAllDependencies>
</configuration>
</plugin>
Probably the Eclipse installation where you want to install your feature does not have an update site configured that contains org.eclipse.ocl. This has nothing to do with your Maven build, as long as you didn't configure your feature to also contain the required bundles, which could also be done.

How to cache artifact from a public repository(e.g., Maven Central) to a private-owned nexus repository?

Basically, I am asking the same thing as the question linked here.
However, I don't think the picked answer solved the question. In addition, the former one was asked years ago.
The Nexus OSS version I installed is 2.11.2-06(the latest version).
I CAN cache an artifact if I search with the nexus GUI and click download button.
However, an artifact IS NOT cached if I declare it in the pom file in eclipse. It will just fetch it from MAVEN CENTRAL and cache it locally in my computer but not in the Nexus Repository.
I WISH when I declare a dependency in the POM file in eclipse, if it is not cached locally, maven will fetch it from MAVEN CENTRAL, cache it both locally in my computer AND in the Nexus Repository as well.
My maven settings.xml is shown below:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>kingstar-internal</id>
<repositories>
<repository>
<id>kingstar-internal-repository</id>
<name>Kingstar Internal Repository</name>
<url>http://localhost:8081/nexus/content/repositories/KingstarRepository</url>
</repository>
<repository>
<id>kingstar-snapshot-repository</id>
<name>Kingstar Snapshot Repository</name>
<url>http://localhost:8081/nexus/content/repositories/KingstarSnapshotRepository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<mirrors>
<mirror>
<id>public-mirror</id>
<mirrorOf>*</mirrorOf>
<name>public mirror</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<activeProfiles>
<activeProfile>kingstar-internal</activeProfile>
</activeProfiles>
<servers>
<server>
<id>kingstar-internal-repository</id>
<username>deployment</username>
<password>deployment</password>
</server>
<server>
<id>kingstar-snapshot-repository</id>
<username>deployment</username>
<password>deployment</password>
</server>
</servers>
</settings>
Any help is appreciated!

m2eclipse not showing latest artifacts in search

I am using Eclipse with the m2eclipse plugin and have setup a nexus repository mirror. When I search for artifacts it does not show the most recent versions; sometimes it shows very outdated versions of artifacts. I usually end up searching online for the latest version. Do I have something configured incorrectly, or is this a bug? I am currently on Eclipse Kepler, but this also happened in the Juno version.
For example, I tried adding the groovy dependency, which is currently on version 2.1.6. The latest (non-beta) shown is 1.8.1:
I don't think it has anything to do with Nexus. I can view my nexus repository in the Maven Repositories view in Eclipse. Also, if I manually type in the latest version there are not errors, so the JAR file(s) are pulled in correctly.
Here is my local settings.xml referencing the Nexus mirror:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>nexus</id>
<username>deployment</username>
<password>mypassword</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<url>http://myserver/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
This is most probably a problem with downloading the index files from Nexus.
Make sure you can find the latest version of the dependency when searching in the Nexus web UI. If this doesn't work, then Nexus fails to download the indexes from the upstream sites. Check for errors in the logs and manually trigger the download.
If the search on your Nexus works, make sure m2e can download the indexes when you start Eclipse. Look in the progress view when you start Eclipse; it should tell you that it downloads the indexes from Nexus.
You can also have a look at the Maven Console (in your console view; enable DEBUG to see more) right after starting Eclipse.
Lastly, you can start Eclipse with java instead of javaw. It will then print some debug information to a console/terminal window.

maven settings for multiple mirrors

I have a few personal projects and few corporate ones. The corporate projects use a mirrored corporate SVN repo for maven dependencies. I would like to configure my settings.xml in such a way that the dependencies are first checked against my corporate mirror. Only when the dependencies are not found here (for my personal projects) then it should check against the original "central" repo that is mirrored by my corporate repo. Is this possible. Below is a snippet of what I have right now but it doesn't hit the "central" repo when required. Thanks.
<servers>
<server>
<id>central-mirror</id>
<username>myusername</username>
<password>mypassword</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
</servers>
<mirrors>
<mirror>
<id>central-mirror</id>
<url>https://url.to.my/mirror</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>my.corporate.proxy</host>
<port>8080</port>
<nonProxyHosts>localhost|*.my.corporate.proxy</nonProxyHosts>
</proxy>
Ok after some trial and error I finally figured out how to do this. I am hoping this will help out many others. Below is my updated settings.xml. For any project in my Eclipse, maven first tries to download libs from my corporate mirror. Only if it can't find it there, it gets it from central repo.
<servers>
<server>
<id>central-mirror</id>
<username>myusername</username>
<password>mypassword</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
</servers>
<mirrors>
<mirror>
<id>central-mirror</id>
<url>https://url.to.my/mirror</url>
<mirrorOf>*,!central</mirrorOf>
</mirror>
</mirrors>
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>my.corporate.proxy</host>
<port>8080</port>
<nonProxyHosts>localhost|*.my.corporate.proxy</nonProxyHosts>
</proxy>
<profiles>
<profile>
<activeByDefault>true</activeByDefault>
<repositories>
<repository>
<id>central-mirror</id>
<url>https://url.to.my/mirror</url>
</repository>
</repositories>
</profile>
</profiles
well I have a similar scenario where if an artifact is not available in corporate repo then it should default to global repo.
I made two changes in my original settings.xml-
define a <proxy> tag for your network
If mirrorOf property is * then change it to repo ID