auto-redeploy with IntelliJ IDEA 13, Maven and vertx-maven-plugin 2.0.2-final

640 views
Skip to first unread message

Nils Preusker

unread,
Jan 21, 2014, 9:19:14 AM1/21/14
to ve...@googlegroups.com
Hi,

I'm trying to use the auto-redeploy feature but can't seem to get it to work following the instructions in the manual or other posts in this group. My setup is:

* Maven 3.1.1
* vertx-maven-plugin 2.0.2-final
* IntelliJ IDEA 13

I tried the following:
  • created a project with the maven archetype (see http://vertx.io/maven_dev.html)
  • imported project into IntelliJ IDEA (File > Import Project > Maven...)
  • added some stuff (Java verticles) so I now have a web server that listens for HTTP POST requests at a certain URL... doesn't really matter here. What matters is that I log something whenever I get an HTTP request
  • executed "mvn clean install" on the command line
  • executed "mvn vertx:runMod" on the command line
  • sent an HTTP request with curl and got the log statement I expected
  • changed log statement in the verticle (Java class)
  • sent another HTTP request and expected the new log statement. However, the log statement didn't change and there was no output that indicated that my changes were picked up either...
I've also tried changing the vertx_classpath.txt. The current contents are:

target/classes
target/test-classes
bin

I've also set the "Make project automatically" (Preferences > Compiler) option in IDEA to true and verified that the class files are updated in the "target/classes" directory... 

Should what I'm trying to do work and can anybody point me to what I'm doing wrong?

Cheers!
Nils

Tim Fox

unread,
Jan 21, 2014, 12:17:03 PM1/21/14
to ve...@googlegroups.com
Did you set auto-redeploy to true in your mod.json?

If so, and the problem still occurs, can you zip up your project and attach it to a github issue
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Nils Preusker

unread,
Jan 21, 2014, 1:12:54 PM1/21/14
to ve...@googlegroups.com
Hi Tim,

yes, I set auto-redeploy in mod.json to true. I'll create a sample project to reproduce the problem and notify you through this thread. Probably won't be until tomorrow though.

Cheers,
Nils


--
You received this message because you are subscribed to a topic in the Google Groups "vert.x" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vertx/a0Mucr2TEEE/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to vertx+un...@googlegroups.com.

Nils Preusker

unread,
Jan 22, 2014, 5:31:44 AM1/22/14
to ve...@googlegroups.com
Hi Tim,

so I've reproduced the above scenario by creating a basic project with the vertx-maven-archetype. Here is the git repo: https://github.com/nilspreusker/my-vertx-module

Steps to reproduce:

* clone repo
* import in IntelliJ IDEA 13 (File > Import Project, choose root folder, choose Maven in next window, all other settings left with default values)
* set "Make project automatically" (Preferences > Compiler) option in IDEA to true
* execute mvn install and mvn vertx:runMod in command line
* add a new log statement in PingVerticle (e.g. container.logger().info("here we are!");)
* check that the class file under target/classes/com/ have a new timestamp

At this point I expected the verticle to be re-deployed but I don't get any kind of output on the console. I also tried it with a web server verticle to have a chance to interact from the console (with curl) but also didn't see any automatic re-deployments there.

Any ideas what I might be doing wrong?

Cheers! Nils

Tim Fox

unread,
Jan 22, 2014, 10:57:56 AM1/22/14
to ve...@googlegroups.com
Works fine for me (although I did it slightly differently, see below):


On 22/01/14 10:31, Nils Preusker wrote:
Hi Tim,

so I've reproduced the above scenario by creating a basic project with the vertx-maven-archetype. Here is the git repo: https://github.com/nilspreusker/my-vertx-module

Steps to reproduce:

* clone repo
* import in IntelliJ IDEA 13 (File > Import Project, choose root folder, choose Maven in next window, all other settings left with default values)

^^ I never do this and have no idea whether it works.

Better to do:

mvn idea:idea to generate the project files as explained in the docs

Then just open the ipr file in IntelliJ


* set "Make project automatically" (Preferences > Compiler) option in IDEA to true
* execute mvn install

^^ You don't need to execute mvn install - Vert.x will pick up the module from the resource in IDEA, not from Maven


and mvn vertx:runMod in command line

^^ Before you do this, just make sure the Java class has been built for the first time (CTRL-F9)


* add a new log statement in PingVerticle (e.g. container.logger().info("here we are!");)
* check that the class file under target/classes/com/ have a new timestamp

At this point I expected the verticle to be re-deployed but I don't get any kind of output on the console.

I can see it deployed fine on the console (I changed here we are to here we are 2)

tim@tim-laptop ~/projects/my-vertx-module $ mvn vertx:runMod
[INFO] Scanning for projects...
[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building Project - my-vertx-module 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- vertx-maven-plugin:2.0.2-final:runMod (default-cli) @ my-vertx-module ---
log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Looking for repos file
Found repos on url: null
Jan 22, 2014 3:54:33 PM org.vertx.java.core.logging.impl.JULLogDelegate info
INFO: here we are!
Jan 22, 2014 3:54:33 PM org.vertx.java.core.logging.impl.JULLogDelegate info
INFO: PingVerticle started
[INFO] CTRL-C to stop server
Jan 22, 2014 3:55:02 PM org.vertx.java.core.logging.impl.JULLogDelegate info
INFO: Module com.mycompany~my-vertx-module~1.0-SNAPSHOT has changed, reloading it.
Jan 22, 2014 3:55:02 PM org.vertx.java.core.logging.impl.JULLogDelegate info
INFO: here we are2!
Jan 22, 2014 3:55:02 PM org.vertx.java.core.logging.impl.JULLogDelegate info
INFO: PingVerticle started

Nils Preusker

unread,
Jan 22, 2014, 11:20:57 AM1/22/14
to ve...@googlegroups.com
Hi Tim,

I got it to work with mvn idea:idea, thanks! Now I guess I would have to check the generated IDEA files (.ipr, .iml and .iws) in order to find out why it works when generating them with "mvm idea:idea" as opposed to using the maven import in IntelliJ... Maybe that's an interesting one for the folks at IntelliJ :) Anyway, thanks for your help and I'll post back if I find out anything more about the IntelliJ IDEA maven import.

(The reason I prefer the  import over "mvn idea:idea" is that stuff like language level settings etc. are picked up correctly right from the start and there is no need for additional fiddling around.)

Thanks again!
Nils

Tim Fox

unread,
Jan 22, 2014, 11:22:53 AM1/22/14
to ve...@googlegroups.com
On 22/01/14 16:20, Nils Preusker wrote:
Hi Tim,

I got it to work with mvn idea:idea, thanks! Now I guess I would have to check the generated IDEA files (.ipr, .iml and .iws) in order to find out why it works when generating them with "mvm idea:idea" as opposed to using the maven import in IntelliJ...

Perhaps a project generated by importing puts its class files in a different place?

The default vertx_classpath.txt assumes they are in target/classes but you can edit this to point at wherever they actually are for your project.


Maybe that's an interesting one for the folks at IntelliJ :) Anyway, thanks for your help and I'll post back if I find out anything more about the IntelliJ IDEA maven import.

(The reason I prefer the  import over "mvn idea:idea" is that stuff like language level settings etc. are picked up correctly right from the start and there is no need for additional fiddling around.)

Thanks again!

No probs!

Brice Dutheil

unread,
Jan 22, 2014, 9:02:01 PM1/22/14
to ve...@googlegroups.com
I have seen IntelliJ put the classes in different places as expected by the gradle run task, maybe there's a similar thing going on when dealing with a maven artifact.

-- Brice

Nick Scavelli

unread,
Jan 23, 2014, 11:20:33 AM1/23/14
to ve...@googlegroups.com

I also prefer to import the project as a maven project. Apparently if you don't do a mvn install/package prior to doing a mvn vertx:runMod then it will work (haven't tested this with mvn idea:idea).

Also I believe the mvn idea:idea plugin is not maintained anymore according to http://maven.apache.org/plugins/maven-idea-plugin/. So I think we should move away from this, and support the way IntelliJ recommends to work with maven projects. I'm not sure how the auto-deploy works, but I can take a look into it.
Reply all
Reply to author
Forward
0 new messages