Build dependent project with Maven - maven

I have a project A of type war (or ejb) which has a dependency on some other war project B of mine.
Is it possible to build project B before including it as a dependency to the project A with mvn package?
Note: I wouldn't like to change the packaging types of my projects and wouldn't like to change the parent-child relationship between my projects.

Related

Is it possible to change dependencies in a maven plugin programmatically?

I am building a maven plugin which I would like to attach to a project which uses the artifact of another project which I'm building.
For instance:
Project A --> Project B
I could run Project A with two different branches of Project B so I would like to checkout and generate the artifact on demand.
Is it possible to access the maven dependencies of the project and remove or add one or trigger another project build?

Best practice to add a maven dependency to an Eclipse RCP Plugin

I want to add some GitHub projects as dependencies to my Eclipse RCP Plugin. The GitHub projects are oshi and leshan.
Both GitHub projects provide maven builds over maven central which i could use.
But as i understand so far i cant use these builds directly in an Eclipse RCP Plugin because it requires OSGI-Bundles - in contrast to an "classic" Eclipse Java project.
So far i found three ways of dealing with this problem:
let Eclipse convert the JARs to an OSGI-Bundle and add them to a Plugin which i can make a dependency on (described here https://stackoverflow.com/a/3594698/12029492)
look if the GitHub projects are available on Eclipse Orbit and add the p2 Repository to my Target Platform. (described here https://stackoverflow.com/a/56854979/12029492) Sadly on the Orbit site is only the oshi project in an older version than it is on GitHub.
create my own p2 repository with p2-maven-plugin and add it to my Target Platform.
I also looked into Tycho but as far as i understand you can only add a p2 repository as a dependency in Tycho, which leads again to the problem of creating one.
Is there another/better way of dealing with Non-OSGI-Bundle Maven builds in an Eclipse RCP Plugin?
EDIT: i found for me the best way to use gradle (a gradle plugin bnd-platform), to automatically resolve the dependencies using maven central and create a local p2 repository, described in Option 1 here https://stackoverflow.com/a/29509794/12029492
Recently the Eclipse Maven (M2E) implemented tight integration of Java libraries from Maven central into the target platform. With this, you can easily add Java libraries to your target platform and they can be converted (if necessary) on the fly to OSGi bundles including their dependencies.
See https://www.vogella.com/tutorials/EclipseJarToPlugin/article.html for how to using Java libraries (from Maven Central) for OSGi, Eclipse Plug-in and Eclipse RCP development.
This extension is also supported with the latest Maven Tycho version for command line builds, see https://www.vogella.com/tutorials/EclipseTycho/article.html

copying packages from different projects to another project using maven

i have different maven projects, i planning to create one more maven project in that i want to copy some packages from above projects. Can I do copy the packages from other projects to another project using maven ?

How to configure two STS gradle projects in eclipse to use another STS gradle project?

I have a two spring boot applications. Each application is setup as a separate eclipse project. Let's call them project A and project B. I also have another project C that contains domain classes. Project A and B need to use project C. All projects are in the same eclipse (Mars.1 Release 4.5.1) workspace.
Per this post and this link, I have
Created a pom.xml at the root of project C and typed mvn install
I have checked "Remap Jars to maven projects", "Remap Jars to Gradle Projects", and "Use Custom Tooling Model" under Window -> Preferences -> Gradle
From the context menu for each project, clicked Gradle -> Enable Dependency Management.
From the context menu for each project, clicked Gradle -> Refresh Dependencies.
After making changes to a domain class in project C and clean and build project C, I clean, build and bootRun project A or B and notice that the changes in project C are not present.
How can I properly configure remapping of jars to gradle projects so that changes in project C are reflected in A and B without having to reinstall to the local maven repo?
I'm using SpringSource Tool Suite Gradle Integration 3.7.2.

Intellij IDEA cannot resolve dependencies in multimodule project

I decide to try Intellij Idea, and I imported existing Maven multi-module project from Eclipse into Idea. But Idea can't resolve dependencies related with GWT classes and some dependencies between maven modules. I tried to re-import maven projects - it don't help.
How I can solve this problem?
Additional info:
Project was imported from Eclipse's workspace (with eclipse specific files, such as .project etc. But I don't think it can be problem). GWT dependencies are exist in pom.xml, but all classes from GWT highlighted with red color. In eclipse this project work fine.

Resources