Tycho Maven: Adding a local repository - eclipse

I have a plug-in project with several dependencies. Among them, there are a couple that are NOT in the official p2 Eclipse repository. They have been installed manually from its "private" update site.
Tycho can not compile the plug-in since it cannot find out where the local dependency is.
[ERROR] Missing requirement: es.uma.lcc.e-motions 2.0.1.qualifier requires 'bundle es.upv.dsic.issi.moment.mdt.maudedaemon 1.3.6' but it could not be found
These dependencies are jars in the eclipse/plugins folder. Can I add this folder as repository to my generated pom.xml?

Related

Eclipse maven not adding dependencies

I am new to maven and am experiencing difficulties while trying to mavenise a Java project.
Setting:
IDE: Eclipse Oxygen.2 Release (4.7.2)
Java: 8
m2e: 1.8.2
What I did:
- copy-pasted the entire original java project and renamed it
- right-click in eclipse: Configure > Convert to Maven project
- in java build path, deletion of libraries import from original local lib repo. The build path shows the Maven Dependencies folder, with the only junit library.
- maven install => downloaded things in the user/.m2/repository/, but not all.
What does not work:
When I try to add a dependency right from a file:
,
nothing pops up in the artifact selection windows, even though there is a commons-logging/ folder in m2/repository
When I try to add the dependency manually in the pom.xml:
<dependency>
<groupId>org.kie.modules</groupId>
<artifactId>org-apache-commons-configuration-main</artifactId>
<version>6.5.0.Final</version>
<type>pom</type>
</dependency>
but the package resolution error still appears in the java file, and I get this warning after Maven install
`[WARNING] The POM for org.kie.modules:org-apache-commons-configuration-main:pom:6.5.0.Final is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details`
I did Maven Update project, eclipse project clean, nothing changes.
My goal for now is just that eclipse understands (at least for one library), that it has to take it from maven repository. I still have many other dependencies to solve (intra-project), but that will be the next step.
Thanks for your help.
The cause of the issue is stated in the warning message :
[WARNING] The POM for
org.kie.modules:org-apache-commons-configuration-main:pom:6.5.0.Final
is invalid, transitive dependencies (if any) will not be available,
enable debug logging for more details
It means that the pom.xml downloaded in your local maven repository exists but is not valid.
Delete the folder of the dependency downloaded in your local maven repository and try again.
If you still have the same problem, check that your central repository that provides the dependency provides also correctly the pom.xml for that.
You can do it by browsing the directory of the dependency from a web browser.
For example we can see that the maven central repository provides a valid pom :
http://central.maven.org/maven2/org/kie/modules/org-apache-commons-collections-main/6.5.0.Final/org-apache-commons-collections-main-6.5.0.Final.pom

Install child modules' 3rd party dependencies to local maven repo

I have a big maven project which has smaller child modules. I imported the project using m2e eclipse plugin and i got lots of compilation errors in eclipse.
After i built the whole project using mvn clean install some of the errors are gone(because maven plugin is able to find those dependencies in local repository and reference them from there), but the child modules still show lots of compilation error because the child modules' dependencies are missing from local repo. The dependencies are getting copied in a /lib folder inside target folder of child module.

Maven building a project using both Maven Dependencies and Referenced Libraries

Is there a command that will let Maven use the Referenced Libraries when building a project?
See the Dependencies section of Maven / POM Reference:
The cornerstone of the POM is its dependency list. Most every project depends upon others to build and run correctly, and if all Maven does for you is manage this list for you, you have gained a lot. Maven downloads and links the dependencies for you on compilation and other goals that require them. As an added bonus, Maven brings in the dependencies of those dependencies (transitive dependencies), allowing your list to focus solely on the dependencies your project requires.

Tycho cannot resolve Require-Bundle: org.sample.ide.common;bundle-version="1.0.0.qualifier"

I build an Eclipse plug-in project with Tycho.
I got this error message.
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.sample.ide.core 1.0.0.qualifier
[ERROR] Missing requirement: org.sample.ide.core 1.0.0.qualifier requires 'bundle org.sample.ide.common 1.0.0' but it could not be found
org.sample.ide.core-1.0.0.qualifier has org.sample.ide.common-1.0.0.qualifier as required bundle.
When I export the plug-in project with the Eclipse PDE export function, the dependent projects are recognized inside the same workspace.
And my manifest.mf has version like 1.0.0.qualifier, and my pom.xml has 1.0.0-SNAPSHOT. Is that problem?
Having artifacts with .qualifier versions is supported, so this is not the cause of your problem.
However I am not sure to what extend Tycho also supports .qualifier replacement in dependencies, e.g. Require-Bundle headers. (At least, this is buggy.) So you should try to build your project with a dependency to version 1.0.0 instead of 1.0.0.qualifier.
Tycho replaces the .qualifier with a timestamp or fixed string in the reactor build within all manifest files. It resolves the files from the repositories defined from the target files attached, and from the local repository. If none of these contain an exactly matching dependency, tycho will not succeed with the build.
Note that the resolution of PDE export is based on the current target set in Eclipse, and that PDE will replace the qualifier for all bundles open in the workspace. Tycho does not know of these, its scope is what is included in the reactor during the build.

Run maven:install will copy more jars to WEB-INF/lib than i expect

Eclipse Indigo; m2e 1.1.0; Maven integration for WTP 0.15.3; Maven 3.0.4
My web project has some dependency projects in the same workspace. All projects are installed. When i run maven install, except to see all dependencies in WEB-INF/lib.
When i run maven install plugin or maven war plugin, the WEB-INF/lib will be filled with dependencies, but they are a lot more than i expected, from the "dependency Hierarchy" or "Effective POM" view of the POM file, or from Maven dependencies in classpath view, i can not find the dependencies.
Run Maven->update projects does not help.
So where these dependencies come from or where should i start to debug?
EDIT
Previously my project has a large dependency tree(100+ jars), some of them are not needed, so i decided to remove them. My project depends on a common project, which has some not needed dependencies, i remove them from POM dependencies and run maven install for the whole projects dependency tree, success. then i run maven install on my project, it should not include the jars i removed from the common project, but, unfortunately they are there in WEB-INF/lib.
If you want to know where your dependencies are coming from, run:
mvn dependency:tree
from the command line. This shows how transitive dependencies are pulled in from your declared dependencies.
You can also run:
mvn dependency:analyze
to see if you can remove any unused dependencies to lessen the number of JARs packaged.
Problem solved, I delete the whole project and import from remote, run maven-install, it worked. Still have no idea why it not work before even after i run "maven clean install" on all dependency projects.