How do I get IntelliJ 10 to deploy a project that uses JiBX? - maven

I have a multi module maven project (a war) on of these modules utilized executes a post-compile step to update JiBX bindings.
I would like to use IntelliJ to build and deploy this project. However I can't seem to figure out how to get IntelliJ to kick off the JiBX compiler. Any thoughts?
If it isn't possible to kick off the JiBX compiler, I'd like IntelliJ to treat the module that requires the JiBX compilation step as a "normal" dependency and simply pull the appropriate jar from my local maven repository.

If you don't have this already... in your IntelliJ run/debug configuration check the "Run Maven Goal" checkbox and choose jibx:bind from the jibx entry under plugins.

Related

Hot reloading a multi-module spring boot application with gradle

I'm trying to convert a project from maven to gradle, but I'm having trouble getting hot reloading to work the same way. I can't show the actual project so I've created two identical very simple projects. One with maven one with gradle. These projects contain two modules:
project
|____api
|____lib
The /api module contains a spring-boot app which depends on code from the /lib module
In the maven project I can change code in either of these modules and recompile either with my IDE (intellij) or with the maven cli and spring-boot-devtools will hot reload the application. However in the gradle version it only successfully hot reloads code that has changed in the /api module.
From what I gathered this seems like a classpath issue. If you run gradle or maven in debug mode it prints out the classpath it passes when it starts the application. Maven includes <project_dir>/lib/target/classes/kotlin/main. However gradle only includes <project_dir>/lib/build/libs/lib.jar
I'm very new to gradle to I might have some of the build configuration messed up. Here are the two project repo's:
Maven: https://github.com/Perry-Olsson/mvn-hot-reload
Gradle: https://github.com/Perry-Olsson/gradle-hot-reload

Having Maven Plugins in IntelliJ IDEA without Maven Installation in Computer

I just started to use Maven and IntelliJ IDEA.
I imported a project into IntelliJ IDEA which requires Maven. I didn't install Maven to my computer but I have 2 plugins in IntelliJ IDEA named as "Maven" and "Maven Extension". And the code I have is running without any dependency problem.
In that case, do I still need to install Maven from the web or just the plugins in the IntellJ are enough for projects with Maven?
Can we say that for every project? If someone can explain the logic behind I would be very happy.
Thanks a lot!
Intellij comes with a bundled version of Maven (see File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven; the property 'Maven home directory' on that screen by defaults points to 'Bundled (Maven 3)').
You don't have to, but you can still install your own version of Maven, and point that property to it. It has the advantage of being able to run maven from the command-line, which is a better guarantee of build-stability (i.e. building the same project in different environments with the same result) than building directly inside of your IDE. And often is way more helpful in investigating build problems.

How do I add a module dependency in gradle.build

I use Intellij Idea. I have a java gradle project with two modules ('main' and 'repo'). I add a dependency in the main module to the repo module, using the "Project Structure" menu. My project builds ok, but when I run a sonarqube task in my project, the module depencency has gone. Is there a way to add a dependency to a module in gradle, so it doesn't disappear?
If you configure your project only in IntelliJ your gradle configuration will not be change because it is an IntelliJ configuration only.
The "normal" way is: first you set your gradle configuration and then just open your project in IntelliJ. Everything will work automagically inside InTelliJ.
Here is the documentation explaining how to add a sub project in gradle.

creating different types of projects using eclipse with maven

I know creating the project using maven with command prompt but if i want to import this project into eclipse i have to run some commands and it will be modified suitable for eclipse, My question is can I create different archetype projects using maven plug in to eclipse, without using maven with cmd ?
You can entirely use Eclipse without using the command prompt. Though I prefer to use both terminal and Eclipse interfaces to utilize the maven project, and is a dynamic way of development. Eclipse Mars already include Maven.
Two ways to do this:
Create a new general project, create new POM file, define dependency and build, and Eclipse will recognize to configure as Maven project without applying Eclipse Project facets.
Create a new Maven project, do not skip archetype selection and use quickstart only if creating a simple Java project with main and test source folders, define module properties (group, artifact, version, etc.), and Eclipse will configure project as Maven project without applying Eclipse Project facets.
To execute a clean install, you need to create a goal "clean install" in Eclipse Run Configuration under Maven. Caution, Eclipse use embedded Maven runtime by default so if you'd like to link with your copy of Maven, you'll need to configure Eclipse to point at your Maven installation directory.
Basically, every command you entered in command prompt need to be a goal in Eclipse Maven Run Configuration to separate yourself from using command prompt.
Example Java Maven Project:
Step 1: Create New Maven Project
The first step to begin Maven-enabled Java development without using command prompt.
Step 2: Eclipse Project Configuration
Most of the time, I usually skip this section unless special circumstance requires a working set.
Step 3: Specifying Archetype
Maven archetype quickstart comes with two source package: test and main. This is the most simplest and efficient option to begin Java development. This is equivalent to -DArchetypeArtifactId=maven-archetype-quickstart option.
Step 4: Define Archetype Parameters
Define your own archetype parameters.
Step 5: Confirm Eclipse generated a Maven-enabled Java project
Double check POM and ensure Eclipse throws no error. In this case, Eclipse warns of Java 1.5 not defined. You can fix this by specifying Java version in maven-compiler-plugin within build tag in POM but that's entirely another thread.
Step 6: Define a Maven Goal
We want to test whether Eclipse can do a "mvn clean install" by creating a new run configuration. You can see the console output in background that Eclipse successfully output Maven build.
Is this what you were asking about?

how to auto build jar by maven when i modify one java class?

I have install m2eclipse plug-in for eclipse. I built a multi-module project by maven, each module are dependent, when i write a class,the eclipse can't automatically compile the class to jar file and install to M2 repository,i need to run MVN install command, then other modules can be reference the jar file, this is too much trouble, is there any good way to solve this problem?
This is because the "install" phase does not belong to m2eclipse's interesting lifecycle phases. In short, Eclipse and Maven build cycles differ a lot, and m2eclipse has a map that binds particular phases — and "install" is, by default, not mapped.
This map can be, however, configured in the POM of your project (ideally, the main POM). See: M2E_plugin_execution_not_covered

Resources