How do I make Maven generate a list of all of the plugins that it recognizes?
"Recognizes" or "uses"? You can see all the plugins configured in a particular project using mvn help:effective-pom. A global list of all available maven plugins would probably be impossible to accurately compile. There are lists of a couple of major clusters of plugins at the maven site and at codehaus, but maven plugins can come from anywhere.
Related
I have an application made up of a number of maven projects. I work on it in Eclipse. Some of the projects use Maven plugins to generate stub classes for web services etc.
When i import the projects into a new workspace I have to issue a maven generate sources command followed by attach source folders to build path on each project. The application i work on has more than 5-6 projects which require these steps.
Is there a plugin I can install in Eclipse to pick up the generated sources, or even one that generates the sources and updates the build path to save the manual steps?
I'm pretty sure the m2e plugin takes care of this automatically. m2e is included in the primary Java and Java EE packages of recent Eclipse versions, so you probably already have it. If you right-click on your project, and there is a Maven submenu, then the project is already managed by m2e. Otherwise, right-click and choose Configure > Convert to Maven project.
Well, it depends on exact maven plugin you are using.
generate sources
Before I considered that m2e connector would be needed for any non common plugin, like generator. But I came recently on some plugins (1), that do it without special m2e connector.
attach source folders to build path
For this part check build-helper-maven-plugin and answer to M2E and having maven generated source folders as eclipse source folders
I am developing an Eclipse RCP application and currently my head's a mess. I simply don't understand how the plug-ins and the other normal projects interact with one another, nor do I see how they interact with org.eclipse.* projects either.
So I have the Java Build Path that states which JDK I'm using, and also any external jars I might be needing, and the Target Platform that states on what plug-ins will the RCP application base upon, right?
Now I keep seeing all these required jars:
Plug-In Dependencies
Required bundles in manifest.mf file (listed in Eclipse in the Dependencies tab)
build properties' additional bundles
So where exactly do these jars need to be? In the Target Platform? or in the Build Path?
Does anyone know a good guide to describe this?
Any help / opinions /suggestions are appreciated.
EDIT: I've tried it out, and it seems that when there is a required bundle, it is resolved by adding it to the Target Platform...
The target platform is where you list the complete set of plugins that your RCP depends on, this might be one of the Eclipse downloads or it could be something else entirely.
The Required Plug-ins tab of the manifest.mf lists the plugins that your plugin uses directly. Eclipse will use this to maintain the class path for the plugin and will manage the Java Build Path automatically.
The Plug-in Dependencies list shows your plugin dependencies plus the indirect dependencies.
I have never had to use the additional.bundles in the build.properties so I am not sure why it would be used, none of the plugins in my RCPs use it.
Also on the dependencies tab is Imported Packages. This specifies packages to import without specifying a plugin, see Why do we need `Imported Packages` when we have `Required Plug-ins` in eclipse plugin dependencies?
While configuring a target platform for an RCP application I've noticed that some of the plugins I've added are listed as 'disabled'. Indeed, if I try to add them as dependencies in the manifest editor they don't show up in the suggested list. The particular plugins I'm looking at are various versions of the same plugin. I have several plugins that require different versions of that plugin. The plugins that have the dependency and the dependency itself are both third party so reducing the complexity of the dependency chain isn't my first choice.
Does anyone know what Eclipse is telling me when it lists those plugins as disabled?
I have several plugins that require different versions of that plugin.
If those plugins are singletons (very likely) then Eclipse only activates one of them. Here's a good explanation why.
I successfully created a project using Wicket quickstart and turned it into an Eclipse dynamic web project by running
mvn eclipse:clean eclipse:eclipse -Dwtpversion=2.0
I imported the project to Eclipse without any issues, but got this warning for each JAR:
Classpath entry M2_REPO/**.jar will not be exported or published.
Runtime ClassNotFoundExceptions may result.
I can fix this by using right click → QuickFix on each warning and selecting "Mark the associated raw classpath entry as a publish/export dependency," but this takes a lot of time and would not be possible if there were a lot of dependencies.
There must be a way to have Maven do this for me; what is it?
EDIT: I've found out that using m2eclipse core + Maven Integration for WTP (from m2eclipse extras) resolves my issues.
I'm still interested in how to achieve this without m2eclipse, though, just out of curiosity :p
The two Maven plugins needed to work with web projects in Eclipse are available from the Eclipse Marketplace.
Maven Integration for Eclipse (included in the Java version of Eclipse)
Maven Integration for Eclipse WTP
currently, I am developing web-apps using Eclipse.
The build is done using Maven.
The problem is that during compile time Eclipse is showing a lot of errors since there are a lot of missing jars. The final result is OK since the Maven is responsible for fetching these jars.
How can make the eclipse not fail the compilation?
I know I can just add the missing jars to the project classpath, but that's not what I'm looking for because I have a lot of projects, and the .classpath file of each project is a file common to all developers, so I would rather not to change it.
My question is therefor, is there a way to add a common classpath to all Eclipse projects without changing each project's classpath?
I use m2eclipse. It adds a classpath container to the .classpath file. This container is populated with the Maven dependencies by a Maven builder (added to the .project when the Maven nature is enabled) which processes the POM and downloads any artifacts (and sources if needed).
To enable the Maven nature (assuming the plugin is installed), right-click on a project and select Enable Dependency Management.
By default m2eclipse uses an embedded version of Maven to do its processing. This typically means a separate local repository and duplicate files on the box. You can configure it to use your standard Maven installation in Window->Preferences->Maven->Installations. Then adding the path to your Maven installation (normally the same as M2_HOME).
There is another Maven plugin for Eclipse called IAM (formerly called Q4E). IAM is an Eclipse integration project and has some promising features - it's worth keeping an eye on.
There is a comparison of the Eclipse Maven integrations, alongside the maven-eclipse-plugin (a goal that generates the Eclipse metadata files from the POM contents). I personally find the maven-eclipse-plugin more trouble than it's worth but it may suit your purposes and it is handy for generating the initial metadata if you have none checked into the SCM.
Check out the m2eclipse plugin. It will read each project's POM and automatically fetch and add all dependencies to the classpath.