osgi projects with several poms in intellij idea - maven

I have two maven projects with 2 poms (type). Some components from project 1 are depending on projects 2. Almost all components (maven) are osgi components.
The question is: since IntelliJ IDEA does not support multi-projects it is impossible to open two projects at the same time in one IDE instance.
Then, I believe, I'm going to have an issue to deploy my osgi components (they have are associated to OSGI Facets in IDE) to my osgi container from IDE (because it supposed to be handled by IDE, using those facets while deploying component to the osgi server, and if I can not see project 2 in my IDE then it could not handle it.. in terms of deploying and ide integration).
For example if I open two IDEs with project 1 in one, and project 2 in second ide, then if I change something in project 2 (1 depends on 2) .. should I configure the same (one) osgi sever in both IDEs, and deploy it separately?
Does someone have the same project structure, and what is the way to work with this in IntelliJ IDEA?

You can have only one IDEA project per window, but a single project can contain multiple Maven projects, see my answer in another post.
Open your first pom.xml via File > Open to create a new IDEA project, then open the Maven Projects view on the right, click on the green plus to add your second Maven project, and voila!
Once this is configured, you can create a new run/debug configuration which will deploy both artifacts on the same tomcat instance.

Related

How to make Spring Tool Suite like a multi-maven-module project?

I'm trying to create a Spring Boot project with multiple Maven modules. I've used the tutorial at https://spring.io/guides/gs/multi-module/ .
This site recommends a directory tree like this:
parent
application
src, and other subdirectories
pom.xml
library
src, and other subdirectories
pom.xml
pom.xml
I developed this project using Visual Source Code.
Wanting to see the project in another light, I tried to import the project directories into Spring Tool Suite. I'm using a recent one, where you apply the STS plugin to an up-to-date Eclipse installation.
Well, STS doesn't really like this project.
The (File, Open projects from file system) sees the project, but the Finish button doesn't actually do anything.
The (File, Import, General, Existing Projects into Workspace) imports a project, but as a Maven project (no "J" icon). When I try the (Run, Run Configurations) it won't see my project.
How can such a project be made friendly to Spring Tool Suite?
Thanks,
Jerome.
To make multi maven projects what you can do is, simply download two separate maven projects from start.spring.io and then extract them and move both folders to one parent folder and try grabbing the parent folder to Intellij, so it automatically downloads the dependencies and other requirement for the project in which we have two maven projects in one single entity
Eclipse can be a bit confusing with several different Wizards to import projects. Ironically the wizards are supposed to make importing projects easy, and in a sense they do... but... unfortunately picking the right wizard itself can be a bit challenging / confusing. Which wizard you use depends on the type of project.
Since your projects are maven projects, the best wizard to use would be the one for maven projects. You can find it at "File >> Import >> Existing Maven Projects".
So give that a try, point it at the 'parent' folder of your project and you should be presented with a relatively intuitive UI to import all 3 projects and configure them for use in Eclipse.

NetBeans doesn't recognize that dependency is a local project - how to fix?

I have two pairs of projects that I develop in NetBeans, both of which have a GUI project, and a library project, where the GUI project depends on the library one. In one of them, NetBeans recognizes that the dependency is local, and indicates as such with an Ma symbol, as seen below, with the dependency project in green:
This provides some nice functionality, most notably that the "Navigate to" (ctrl+click) functionality from the GUI project takes me to the source code in the library project. I also don't have to manually rebuild the library project for the GUI project to pick up any changes.
However, for the other pair of projects, NetBeans will pick up that the dependency is in my local Maven repo, but does not recognize that the source code is a Maven project that it also has open:
I've tried looking through all the right-click menu options, removing and re-adding the dependency from the NetBeans GUI, comparing the pom.xml, comparing nb-actions.xml, and nb-configuration.xml, but cannot find any explanation of why one library is recognized as local, but the other is not. The only information I've found online is at http://wiki.netbeans.org/MavenBestPractices, where it notes:
"Hint: If you open a project that other projects depend on, the icon in other projects changes to a "maven project" icon to denote that the IDE knows about link between the projects. However such a link is only established when the groupId, artifactId and version all match in the dependency and project declaration. Frequently occurring problem is that you change an API signature in your library project, but the application is not picking up. Often it's caused by the fact that the application is using an older version of the library artifact. The artifact icon can help you track down these problems."
However, I've verified that the pom.xml of the GUI project depends on the version being built in the library project, and even made the versions identical between the GUI project and library, and the "maven project" icon still doesn't show up.
Does anyone know how to debug this issue, or if there's a magic setting somewhere that I'm missing for how to make this link work? I've been trying with both NetBeans 8.2 and 8.1, and am compiling with Java 8 for both the successful pair of projects, and the unsuccessful ones.
Revisiting the project a couple years later, I finally figured out a way to get the dependency to connect locally.
Change the artifact ID of the dependency, and update the dependent pom to match the new name.
This is admittedly bypassing the root issue rather than addressing it, but given the inability to pinpoint the root cause, seems the best option at this time.

How to create a Java EE 7 Maven IntelliJ Project

I am new to Stack Overflow because of my frustration to build a working Java EE 7 Project with Maven and IntelliJ ultimate.
I learned a lot about JPA and JSF in the last weeks and am thrilled to put my knowledge to use but unfortunately I am not able to create a working project structure as I get all sorts of errors along the way. I haven't found a single up to date tutorial which is working on the entire Internet.
My greatest achievement is creating a Maven project, and run the index page on a Jboss Wildfly (11) server.
I know Maven (3) requires a certain structure to work, I read that it is the one in picture 1.
Picture 1
Furthermore I know that I can add framework support by right clicking the project name and that I can add facets or modules by selecting files and project structure.
I would be very thankful if someone could explain the right creation of such a project. I already wasted double digit hours and lost a lot of fun.
I had to create a Maven Project with IntelliJ. After that I added JavaEE Application under Framework Support and checked the boxes for JSF and Web Application under Java EE aswell.
Now this doesn't work alone, I had to put this in the right structure Maven requires. I moved the META-INF Folder to main/src/resources. After renaming the web Folder to webapp, I moved it to src/main.
To check, go to Project Structure/ Facets and check if the paths are set correctly.
After adding a local Wildfly 11 Server Artifact (war), IntelliJ starts the default browser and I get to the index page.
The Project Structure
I recommend you take a look at JetBrains page, they have a lot of tutorials on how to use their products. Here how to create new Maven project:
https://www.jetbrains.com/help/idea/maven.html#maven_create_project
Also, here you have information how an example pom.xml file looks like and how to build it:
https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
When you develop your project you can add dependencies to the pom.xml file

how the best way to create project with maven on eclips?

i know there are 2 methode to create project with Maven.
Create Dynamic project on eclipse and convert it into maven project
Create Maven project with command line and then import the project into eclips.
i always do the 1. choise.
If You have latest eclipse IDE then its very simple.
Go to Create new Project wizard and search maven project. (if its old eclipse IDE then you probably need to install m2e plug in from market place).
select maven project and next. Check (Create a simple project) if you want customization other wise just click Next and You will be presented a number of ready made archtypes.
For simple console projects you can chose maven-archtype-quickstart. or what ever project you want to create.
Now Give groupId e.g. com.yourcompany or com.yourprojectgroup and artifactId e.g. projectname-alias . and Click Finish.
First Time eclipse will create local repo if its not already created and then put default dependencies defined by provided pom in your local repo. Further you just need maven knowledge to customize project. e.g. New Dependencies and build system etc.
I hope this will clear your mind. I prefer this way because its fast and easy.
If you create a new project in Eclipse (at least in Mars or Neon), you can choose "Maven Project" and get everything you need. Don't use eclipse goals of Maven. They are deprecated.

How to pass on changements on server without to be forced to build manually all sub-modules changed?

Hello all !
In my team we currently use Eclipse but I am not satisfied and I wanted to discover netbeans (8 version). It seems very nice. There is a good management of webprojects( angularJS, requirejs). There is a full integration of maven project and Java EE project, it's free ( not like intelliJ) and it seems more intuitive than eclipse et less strange/magic , more compréhensible (because full integration of maven)
There is a lot of points who could push my team to adopt this IDE but there is a problem,a need that I can not satisfy.
I have maven modules projects with dependency mangement. A parent project (called 'webParent' that contains a reference of a big parent project of the team. 'webParent' also contains a sub project 'WebProject' that is a java Webproject that contains web resources( html, js, css) and a java rest webservice management.
'WebProject' use service by injection dependency of an other project called 'business'. 'business' is a part of an other parent project called 'core'. 'core' contains modules that are 'business' (business services of application), 'dataAccess' (gather all DAO), 'External' (gather all external webservice) and 'Authent' (authentication ..).
All these core modules are linked.
'business' need => 'dataAccess' , 'External', 'Authent'
'External' need => 'dataAccess'
'Authent' need => 'dataAccess'
Netbeans has perfectly integrated my project, no problem with that.
I could perfectly use my previous jboss install. Netbeans and jboss work perfectly together. but my problem is that my modifications are not take in account by jboss on redeploy.
I have installed this plugin in my webproject https://docs.jboss.org/jbossas/7/plugins/maven/latest/
Indeed it work fine. When I need to redeploy my project I launch jboss-as:redeploy and a war is regenerated and sent to jboss. Jboss restart speedly and it's cool. But if I modify the java code
in my sub-modules (ex: business) I am forced to click on build button (the hammer) on each sub project I modified. Wait that build say "nothing to compile (indeed the compile on save is checked for all project), regeneration of the jar module"
And I stop on this detail. The "jar". Indeed when I verify my local repository my module jar is not changed with compile on save, it's just the target folder of the project that is modified.
So when I launch the redeploy, the plugin launch the build of my webproject who search my modules jars on my local repository. And take a version not modified ..
This problem slowed a lot the developpement and because of it my team will never use netbeans in the future..
The other problem is that I am forced to lauch jboss-as:redeploy to redeploy web ressource (html, css, js) . For me its should be automatically repercuted on my server. But the problem is that jboss use a war that is generated on install.. What's the solution ? With eclipse it's not based entirely on maven (not cool) but the repercution of modification is very speed ( cool)
Help me to stay on netbeans ! ;)

Resources