So we have the following scenario
We have projects using maven with Intellij in a non osgi enviorenment and then we have projects using eclipse in an osgi environment. The eclipse projects are developing RCP-applications and is therefore using the plugin architecture (OSGI).
So we have:
Projects A – maven organized project in a non Osgi-enviroment
Projects B – maven tycho for creating application, but using eclipse project structure with target platform and so on.
Projects C – maven organized projects with maven-dependencies that should work in both projects A and B.
We also have installed Nexus with the p2-plugin so that maven-tycho can work.
The big problem we have is that we can’t figure out how to construct Projects C so that it works without problems for both projects A and B. In projects A we want that maven should work as usual and pulls down the dependencies as needed. But we also want that functionality in projects B (maybe with the combination Nexus+Tycho??).
How should we solve this problem. I haven’t found a good solution for how to do this. I have tried apache felix bundle plugin in maven, but can't get it to work as I want. Is that the right solution?
I think that your best bet is to use the Nexus P2 Repository Plugin.
You can develop and deploy standard OSGi bundles for the Project C using the maven-bundle-plugin, those bundles are directly usable by Project A via maven builds.
Then, by using the Nexus P2 Repository Plugin, you can also expose those OSGi bundles as a standard P2 repository, that can be consumed by Project B via tycho builds.
Related
I recently used the Library Manager in Netbeans (8.2, on Windows 10) to add a library, as show below:
However, in most guides I find online, in order to actually add the library to the project, I should do the following:
Right click the project -> Select the Libraries tab -> .... further steps ....
However, I haven't even been able to make it past the second step: the Libraries tab simply does not exist on my project properties, as seen below: Is this because the structure for a Vaadin web app project is so different from other Netbeans projects? Any advice would be appreciated
tl;dr
Don’t.
Do not configure libraries manually for your Vaadin project.
Instead, create a new Vaadin project using the template of a Maven archetype provided by the Vaadin Ltd company. Locate and edit the new project’s POM.xml file to list the libraries you need Maven to automatically download and install.
For Vaadin Framework (Vaadin 8), see:
Using Vaadin with Maven
Overview of Maven Archetypes
Maven
Usually Vaadin projects are configured using the Apache Maven tool.
Maven is quite popular across all kinds of Java projects. All three major IDEs (NetBeans, IntelliJ, Eclipse) support Maven-driven projects as an alternative to their own particular project definition system.
Maven has two purposes:
Configure the project parts and define a series of events for the compile-and-build process. You can create a new project pre-configured this way by starting with a Maven archetype (a project template).
Manage “dependencies”. This means you tell Maven what libraries your project needs. Maven then reaches out over the Internet to access a Maven-oriented repository of known libraries. Maven downloads your needed library from that repository, placing it in an appropriate place within your project. Tip: Be patient the first time you do this as Maven builds a local cache of the repository’s database, taking several minutes or more.
You specify both the project-build configuration and your list of desired libraries (“dependencies”) in one or more POM.xml files.
Using Maven eliminates the need to place libraries manually as you are attempting to do. No need to touch the NetBeans Library Manager. Indeed, I believe manually configuring libraries will conflict with Maven, with troubled results.
Using Maven is annoying at first, having to learn the lingo and the concepts. But once you are orientated, Maven does save you time and trouble, and makes your developer life easier. One big benefit: Maven makes switching between the 3 main IDEs much easier since you don’t have to learn about each one’s own idiosyncratic project-build-system.
I recommend you take a few hours to learn the basics. You’ll find many introductions and tutorials on Maven.
The Vaadin Ltd company provides a few good Maven archetypes for a new Vaadin project.
vaadin-archetype-applicationOne is a simpler structure, good for learning Vaadin and also good if building a simple small app.
vaadin-archetype-application-multimoduleAnother archetype is a “multi-module” Maven archetype, good for more serious Vaadin apps. One major feature is that your backend logic such as database-access can be separated from your user-interface logic, each in separate modules. You should definitely start with the simple archetype first. Don’t touch the multi-module archetype until you are comfortable with both Vaadin and Maven (unless you have the guidance of a helpful colleague who is a Maven maven).
By the way, Vaadin development in previous years virtually required the use of a Vaadin-savvy plugin that you would have to install into your IDE. Such a plug-in is no longer needed, now supplanted by Maven. You can ignore old outmoded guides to Vaadin that talk about an IDE plug-in for Vaadin.
Note: This entire Answer applies to Vaadin 8 (Vaadin Framework) specifically, and probably Vaadin 7 (as I recall). Vaadin 10 (Vaadin Flow) is a new ballgame, and I am not yet familiar with the situation there.
I have recently started out on Maven. I am trying to integrate Maven+eclipse(Juno)+tomcat7.
I have downloaded m2e-wtp plugin for eclipse and created a Maven project whose structure follows a standard Maven project structure. It is also configured a dynamic web project.
It is a multi module project with two modules of flex(f1 AND f2) and one module of webapp(w).I have configured all the plugins correctly and there is no problem with configuration of POMs.
What I want to achieve is :
When I clean and Build project in Eclipse using Project-->Clean,Eclipse does not build the war in target folder of my web application project (w). I also does not copy any of the flex resources to target folder. However,
When I run the project as maven build by right-clicking the web application project and running it as a "maven install" it creates everything as expected.
My question is that if it is possible to achieve what I mentioned in point (1)? Or the only correct way to do this is the way mentioned in point (2).
I am also not able to deploy the generted files in step 2 automatically in tomcat.
Do I need to use another maven plugin for this?
Please note that this i my first experience with Maven + eclispe. I have followed certain tutorials. So, Please be lenient while voting negatively.
From what I know it is not possible to force Eclipse to use Maven directly (I would gladly be proven wrong).
Eclipse does not use Maven to build (1). Using the m2e plugin, it is possible to run maven to perform the build as you discovered (2).
If you are looking for that kind of tight integration you can look at NetBeans or IntelliJ who are using Maven natively.
EDIT:
About (3) there is a Tomcat-Maven-Plugin that can deploy the WAR file created on a running tomcat instance. Check the Usage page for more details.
I've been beating my head against a wall for about 6 months now and have not found a concise way of understanding the mechanism for developing an eclipse plugin with third-party resources.
We are attempting to develop an Eclipse ODA to ride on top of in-house Spring-based code that accesses a REST based info set.
In broad strokes - this is what I feel that we need to be able to do:
Augment our maven artifacts with Eclipse bundle information using tycho or a the felix bundle plugin.
Set up a plugin project through Eclipse for the ODA Implementation & UI.
Have Tycho generate the poms etc for the plugin.
Now here's where I get muddy. I understand that there are two approaches
Manifest-First - which is the standard mechanism for defining a plugin's dependencies
POM-First - which provides dependencies via Maven's resolution mechanisms.
I'm not entirely sure where to begin trying to start doing this as I've never worked on developing an eclipse plugin.
One of the other questions I have is, how does a developer of an eclipse plugin (maven aside) leverage already existing third-party code (i.e. Apache HttpClient 4.x)? Do they have to download the jars, dump them into a directory within the project, add to classpath, then go from there or is there a "repository" mechanism similar to what is used with ivy, maven, gradle?
Thanks in advance and I apologize if I was rambling a bit with that.
Disclaimer: Your question is very broad, so it is impossible to answer it completely. Still, I can give you some hints so that you know what to search for.
In the Eclipse universe, the primary source for libraries (in the sense of binary dependencies) are p2 repositories. However, since p2 repositories are rarely used outside of the Eclipse context, you won't e.g. find a p2 repository on the Apache HTTP Client project's download page.
To account for this problem, there is the Eclipse Orbit Project which provides libraries used by Eclipse projects in p2 repositories.
If you can't find the library or library version in the Eclipse Orbit, you may also be able to use the libraries from Maven repositories. This is for example supported by Tycho via the pomDependencies=consider mechanism.
Note however that Eclipse plug-ins can only depend on libraries which are OSGi bundles. So if the library in the Maven repository is not yet an OSGi bundle, you need to convert it to an OSGi bundle first, e.g. with the maven-bundle-plugin and the Embed-Dependency mechanism.
The best way for an Eclipse plugin to consume libraries is as OSGi bundles. You just install those bundles into your target platform and reference them in the same way as eclipse.org plugins. Some of the library providers already offer their libraries as OSGi bundles. Absent that, you can typically turn a plain library jar into an OSGi bundle simply by adding a few manifest entries.
Depending on the build system you use and whether the libraries you need are available as OSGi bundles packaged into an online p2 repository, you can reference the URL and rely on your build to download and install the bundle.
If question of choosing a build system for Eclipse plugins with dependencies is still relevant:
Today I released new gradle plugin: Wuff version 0.0.1, which (I think) completely solves the problem. It allows to build Eclipse bundles and applications as they would be "normal" Gradle projects. All OSGi woodoo is auto-generated (although customizable). All dependencies are usual maven dependencies - regardless of whether dependency is OSGi or "normal" library.
Sources and doc: https://github.com/akhikhl/wuff
The base of our enterprise application is OSGI and we have several Java projects that are logically OSGI bundles. We use Maven to compile the application using the Maven Bundle plugin. But this process is time consuming and makes it impossible to debug the application. We also use the Runner and Pax(:provison) plugins to run the application. If we could rely on the Auto build function of Eclipse and also debug the application it would make our lives so much easier. Is there a way to configure Eclipse to be able to compile (and may be run) an OSGI-based application?
I'm not entirely sure if I understand you, but here goes.
Well, running/debugging OSGi applications in Eclipse is really easy, as long as your bundles reside in PDE aware projects or at least are on your target platform.
Do you have the source of all your bundles? Debugging without source isn't all that useful. If you do, can you just import all the source of your bundles into your Eclipse workspace?
Otherwise you can create a target platform, add all your bundles to that. (as a first attempt, I'd say dump all your bundles in a directory and point the target platform there)
Either way, then you should be able to Run (or debug)-> OSGi framework -> New -> Pick your bundles -> Start
You can both pick bundles from or target platform and from your workspace.
For building, you can use Eclipse Plugin Development Environment (PDE). Despite its name, it isn't specific to building Eclipse plugins and can be used for working on pure OSGi bundles. Eclipse plugins are OSGi bundles with some extras.
Cannot help you with the running or debugging part, although I do know that some enterprise-oriented OSGi platforms provide extensions to PDE.
If you're already using the maven bundle plugin, you may find that PDE's manifest-first approach isn't a good fit with your existing code-first build (I assume at the end you want both an IDE build for development and debugging, and a command-line build for continuous integration and automated testing).
You have two choices. As others have suggested, you can use Eclipse's integrated PDE, and use Tycho for your maven build. Tycho uses the same data used by PDE, so you don't have to write things down more than once. Alternatively, you can stick with the maven bundle plugin and use bndtools within Eclipse. Like the bundle plugin, bndtools is code-first, so you won't need to worry about maintaining manifests. However, you may find there isn't quite as big a set of features in bndtools as in PDE, and I'd suggest still checking your manifests by hand to make sure you understand what's being generated. Whether you prefer manifest-first or code-first is a bit of a heated philosophical debate.
Look at bndtools. bndtools is using the same bnd that is underlying the maven bundle plugin. You can even use bndtools together with m2e. bndtools is available from the Eclipse market place.
I'm asking about the approach to deal with Shared Libraries In maven project
Currently we are working on many Java EE projects, having some internal-developed shared libraries (Wars) installed on Weblogic application server
Is it bad approach to add those shared libraries to the project through eclipse class-path as we are working on eclipse IDE, if so what is the best practice for this?
Well, since you are using Maven, you should just be able to turn these shared WAR files into Maven artefacts, and add them as dependencies to your main WAR file.
Since you won't want to put those WAR files into a public repository, and you don't want to build them yourself, you need a group-level or organization-level Maven repository in which shared libraries and other useful things can be stored. (We use Artifactory ... but there are other products that fill the same niche.)
I think install archiva in your company network and deploy all war/jar that. See Maven Deploy Plugin documentation for details. Use that repository as one of repositories.
See Maven Repository Manager Feature Matrix for comparison.