I am using NetBeans 6.9 Beta and I would like to accomplish the following:
Set up a project representing the main application using Maven (for instance "Maven Project", "Maven NetBeans Application")
Ideally, the project should only contain the necessary libraries to run in Apache Felix (I would like to be able to right-click the project and select "Run in Felix")
I do not want that the project contains all the NetBean Platform APIs
I would prefer to implement the modules using OSGi. For instance "Maven OSGi Bundle", "Maven NetBeans Module" + OSGi
These are the problems, which I have at the moment:
The standard Maven archetype ("Maven NetBeans Application") seems always to select all APIs and I have not found a way to deselect APIs - in normal NetBeans Platform Applications that can be accomplished by going to the project properties and deselected the platform modules) - I guess it has something to do with the NetBeans repository (http://bits.netbeans.org/maven2)? Do I have to create another repository?
When creating normal "NetBeans Module" with OSGi support, the modules contain both NetBeans Module and OSGi meta data, which is nice. So, for instance the tool support in NetBeans is available for both technologies. But the "Maven NetBeans Modules" have only NetBeans meta data and the Maven OSGi Bundles have only OSGi meta data).
3. I figured out how to add modules to the project by using project / new and then placing the modules in the Maven project folder. However, I do not quite know yet how I could link to modules from other locations (NetBeans uses Maven modules, which have to be in the same directory as the project?).
Below some useful links for Maven + OSGi in NetBeans
wiki.netbeans.org/STS_69_Maven_OSGI NetBeans Maven OSGi Test Specification
platform.netbeans.org/tutorials/nbm-maven-quickstart.html NetBeans Platform Quick Start Using Maven (6.9)
wiki.netbeans.org/MavenBestPractices NetBeans Maven BestPractices
maven.apache.org/pom.html#Aggregation Maven Documentation Multi-Module Projects
(sorry about the missing protocol but couldn't post the message otherwise)
your nbm-application project depends on all platform projects.. just use the regular maven dependency management (adding/removing dependencies, adding dependency excludes to limit your platform
configure the nbm plugin and the bundle plugin yourself to sequentially append content to the manifest file.. I think Fabrizio Guidici's forceten and bluemarine projects do that in some way..
I don't understand the problem entirely. maven modules are a different thing than netbeans modules. you can for sure compose the application from multiple independently build nb module artifacts.
Related
I need to setup https://github.com/adminfaces but i can't make it work at all. I get errors in wildfly deployment.
I setup intellij project, i select framework support for JSF, and Primefaces which are prerequisites. But than docs say:
Add admin theme to your classpath:
<dependency>
<groupId>com.github.adminfaces</groupId>
<artifactId>admin-theme</artifactId>
<version>1.0.0-RC9</version>
</dependency>
How do i do this if i don't use maven? Can i set it up, via some jar file. Also i don't get it, if i download release from github, what is install.sh?
But even if i added it through maven via Intellij browser it still doesn't work. Can't deploy to Wildfly.
Maven library can be added to non Maven project through Intellij IDEA.
Project structure->Libraries->Add library->From Maven
AdminFaces jars are published to maven central, you can download it there, see here.
Just add admin-template and admin-theme to your classpath.
Also it depends on OmniFaces (2.x) and PrimeFaces (5.1.1 or greater) and also JavaEE apis such as servlet, EJB, CDI, JSF and JPA.
If you are running it outside a JavaEE container such as Tomcat take a look at Admin Starter Tomcat dependencies, you should be able to download them from maven central as well.
Currently I'm working on a Maven plugin that should generate files in all projects (OSGi bundles) that have a certain Eclipse project nature.
How can I access the contents of the projects included in the build and the project natures by using the Maven API?
Maven is a standalone build tool, not an Eclipse plugin. You cannot access Eclipse project settings from core Maven API.
Eclipse supports Maven with the M2E Eclipse plugin. It is possible to write M2E extensions and in the extension you can query the project natures via the functions of AbstractProjectConfigurator class.
However, M2E extensions will not run when you compile your code in the command line. I suggest that you choose one of the followings:
Write an Eclipse plugin that generates the source code into the src folder of the maven project. Code generation should be started by the user manually (selecting a context menu in the project or something).
Avoid using Eclipse project natures and solve your questions based on analyzing the source and pom of your project.
If you need to react on certain aspects in the source code like it looks from the thread with Balazs then you can simply write an ordinary maven plugin and include it in the parent pom. It will then run in every project and can analyze the code and react based on it.
Background
Download and install IntelliJ 12.04 Community Edition
Create project from external source (point to Gradle build script)
Specify JDK 7 as project's SDK
Note: Project is open source at github: Netflix/karyon
Problem
Want to simply war the project. In playing on the commercial version with GAE plugin installed, I was able to specify the Web Application facet, and create the war via the artifact functionality. With the setup described above, the only available facet is Android.
Question
How can I create a self sufficient war (includes all dependencies and hence can be dropped in any container without additional classpath requirements) from within the IDE?
IntelliJ IDEA Community edition doesn't have Java EE support, you need to use some other tool for packaging the war (e.g. Maven).
I am new to Maven and using it to build a project on my local. This is working nicely on my local. Now, I want to run the same project on my server and the server does not have Maven installed. So I wanted to ask if there is any way by which, when I build a Maven project on my local, I could include all the required jars in it and then simply transfer it to my server? I know Maven creates the repository in C:\Documents and Settings\username\.m2 on Windows.
But how can I include all the jars in project the way we do traditionally? I saw this question. But it talks about creating a custom repository and I don't have Maven installed at all. so I guess it is not a suitable solution to me.
Thanks.
You can use the Maven Assembly Plugin. From the documentation:
The Assembly Plugin for Maven is primarily intended to allow users to aggregate the project output along with its dependencies, modules, site documentation, and other files into a single distributable archive.
I'm building my application to run in an OSGi container. I use Maven and the Maven Bundle Plugin from Apache Felix to set up the OSGi manifests for my own modules and that works great.
Now, I'm deploying my bundles into an OSGi container together with several 3rd party libraries. Some of these are already OSGi-fied when I get them from the Maven repos, others, I want to convert into OSGi-compatible jars. I want to set up a Maven project that collects all dependencies, and puts each in its own OSGi jar. The ultimate goal is to collect these jars and my own into an assembly that I can use as a standalone deployment package.
I know how to convert standard jars to OSGi jars, and I have a (somewhat hackish) approach to merge multiple OSGi bundles, even if I probably shouldn't. But if I have a dependency that's already fine as it is, and I just want to copy it from the repo into my assembly, what part of Maven do I use? The bundle plugin is wrong, it messes up the manifests if a dependency is already OSGi-compatible. Do I use the dependency-plugin, the assembly plugin or something else?
I have the feeling I'm overlooking something very simple here.
Did you have a look at the PAX tools? In particular Pax-Runner and
pax-construct... They do not only give you a nice template to start with, but also solve most the problems you mentioned for free.
We use many libraries which are not OSGified by the vendor and which are not available on the Spring bundle repository. We also have many of these and want to deploy them all together hassle free. For this we have created a 2-layer maven setup:
Individual maven projects that either download or contain (as 'system' scope depends) the 3rd party lib in question, and OSGify these using the Apache Felix bundle plugin
One container project that has a dependency on all of these small projects and makes an assembly of them using the core assembly maven plugin. This POM also uses the copy-dependencies goal of maven to make sure everything is in place.
Once it is turned into an assembly (ours is a tar file) we deploy this to our servers. We have gone one step further and used this assembly of 3rd party libraries as the Target Platform for our Eclipse build environment. But this may be irrelevant for you.
You can get OSGi friendly versions of many common artifacts from the Spring bundle repository. So you may not have to do it yourself.
See details of how to configure the bundle repository for Maven.
(will update with some ideas for those that aren't available as bundles already)