I have a simple basic question. If I develop plugin for Kura in eclipse with maven, can I use dependency feature of Maven? I mean, when I use Maven for my Spring projects, I simple add dependency to pom.xml file and I can use in my project. Since I run Spring project on my local machine, dependent .jar files can be used runtime. This time, I will deploy my plugin to another device (Raspberry) , I have to put everything in the bundle .jar package. Can Maven do this or should I add dependent .jar files to classpath manualy?
You can use maven shade plugin to build the so called uber-jar - one jar that will contain your project along with all the dependencies.
Related
We have a multi-module maven project that was recently converted from Ant+Ivy. One of the modules is a legacy custom pluggable component which looks for plugins on the classpath and loads them. Another module in the multi-module project is a plugin implementation that is run by the aforementioned plugin.
When running our custom application server from an eclipse run configuration, we must include each of our plugins on the classpath. As we build within the eclipse workspace these plugins are not compiled to a jar. Hence, there is no jar artifact to include.
If I add the plugin module project as a dependency in the eclipse run configuration, its transitive dependencies (supplied by Maven) are not inherited. Hence, class not found exceptions occur when the plugin is found and loaded by the Application Server.
The problem here is that upon importing the multi-module project, the m2e plugin does not set the maven container to be exported. Thus the missing transitive dependencies.
Is there any way to make this work whilst still running in eclipse using "build in workspace" for both the Application Server component and its plugins.
Ivy is just a dependency management tool where as Apache Maven is a software project management.
Means It can handle all process in software development like compiling,building it to jars, search for depencies,linking, etc.
you no need to give your jars in classpath instead put it in your local repository or edit the pom.xml to fetch from remote repository.
this link http://ant.apache.org/ivy/history/2.0.0/use/makepom.html
We have a non-trivial multi-module maven project, then have a single module maven web-app that depends on 2 modules in the larger multi module project.
When we use eclipse to deploy to tomcat, it doesn't deploy all the jars that are required (spring, camel, etc) by the projects in the multi-module projects, but the multi-module jars are present???
But if we were to do an export of a war file on the single module app it includes everything we need spring, camel, and all the multi-module jars as expected? Why do export and deploy work differently and how can I get deploy to work the way I want.
We are using eclipse 3.6.2 with m2eclipse and other plugins. It seems Eclipse Indigo is worst at handling maven projects than 3.6.
This seems to be the same problem that I encounter semi-regularly. Open the build path for the project, and in the Exports tab, check the Maven dependencies checkbox. Do a clean and reploy the webapp.
It may be necessary to remove & readd the webapp to the server, and I usually have to quit Eclipse and restart it.
I have configured my POM to include the Maven-Surefire plugin, as well as a dependency to a repository with some Selenium stuff.
After running mvn eclipse:eclipse, my project now has 100 jars, including the Jetty, Spring, and Selenium jars, all at the root of the project.
The project builds and runs fine, but how can I put the jars into a directory so it doesn't look so bad? Is this something I can configure in the POM?
Instead of using the maven eclipse plugin ("mvn eclipse:eclipse"), you could use maven eclipse integration plugin (m2eclipse), all your jars will stay in the local repository.
We have existing maven project. I have imported it with m2eclipse plugin.But
I can not run the project. Tomcat can not see resources(WAR files under target folder).
What am I missing? BTW we have multi-module project(2 WAR files).
Thanks in advance!
You need to add the tomcat server in your eclipse.
The maven project should be a web based project
You need to add the web project to the tomcat server.
You need to add J2EE Module Dependencies - Eclipse 3.3 ( To enable all library dependencies to be available at runtime to tomcat). Paths that point to your m2 repo & the lib files.
It may be Java EE Dependencies in earlier versions.
Both your projects needed to be added similarly.
Is there a way to do incremental deployments with these three tools when in a multi-module project?
Example of Maven project:
project
project-data
project-service
project-webapp
The above are Maven modules with dependencies between them. The project-webapp module contains the .war file, but I don't want to create a new .war file every time I need to deploy. Is there a way to perform deployments upon file saves?
Use the Eclipse WTP support (and either the maven eclipse plugin or m2eclipse to import your project as a dynamic project). Did you try? Are you facing any particular problem?