Deploy a Maven application in IntelliJ 12 without building with Maven - maven

I have problem with configuration of maven project in IntelliJ. I deploy my application to JBoss, when I start JBoss server via IntelliJ, application is deployed without any additional actions, but when I try to redeploy application after some changes, IntelliJ try to make project with it's own make process, and it fails. I have to make project via maven and restart server to redeploy application. Can I somehow tell intelliJ to use maven while redeploy application? I cannot see such option in Run/Debug configuration window.

I think you are using exploded artefacts (present icon) Server, Deployment Section. Right?
There you can choose the external artefact and disable the make flag.
I always using exploded artefacts, because of the hot code deployment. So I do no need to deploy artefacts again and again.
Please be aware if there is already an artefact (e.g. foobar.war) in the same location (maven target directory), you have to change the name of the exploded artefact (e.g. foobarE.war). Idea is creating a folder named foobarE.war.

Related

Maven deploying without uploading any pom file

I'm building a multiplatform javafx application. The final process is to create an installer (exe,dmg,deb.. with jre bundled) and upload it to a special "product release" repo. Given how javafx build needs to be done, it runs an jenkins matrix job on 3 different platforms. The last step is the deployment. I attach the installer with the build-helper-maven plugin.
I'm able to upload the installer correctly for one platform, but because the deploy seems to upload the pom file, it cannot be uploaded again from another jenkins slave.
First I was having problem of maven uploading the "main jar", but I managed to disable that by binding the jar plugin to 'none' phase (I use the maven-javafx-plugin which creates own main jar). However I'm unable to disable the pom generation and uploading. I have set
<generatePom>false</generatePom>
for the maven-deploy-plugin but it seems to not have any effect (I assume it works for the main jar which I have already disabled).
Is it possible to disable the pom generation/upload completely (similar like gradle's 'uploadDescriptor false' option) and only upload 'attached artifacts' ?
EDIT/NOTE: I probably try the deploy file option next, https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html, but it would be nice to know if this can be done on the complete project level
I managed to solve this. I did it with the deploy-file option:
I bound the default-deploy to none in order to disable it. Then I made new "native-deploy" execution which I bound to deploy phase. In it's configuration I put the generatePom false and pointed the file to the same I was earlier using to attach it as side artifact (via the build helper plugin). I did have to put the coodrinates again (i.e. passtrough from project.*). But did work and uploaded the installers from all machines without any pom files. I did have to re-enable the default jar creation because maven complained that there is no artifact bound (I guess I could change the packaging to be pom, anyway it is not uploaded because the default upload is disabled so ok there).
I guess if there is more general solution it would be more correct answer but for me this is enough.

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 ! ;)

Deploy Mavenized EAR project without packaging to EAR

I have a "mavenized" EAR project like this:
PARENT
EAR
EJB
WEB
The problem is that I have to do
mvn clean package
on PARENT project every time I want to deploy. Just after this, I get the EAR and do
mvn glassfish:deploy
on a running Glassfish instance.
All this process is a bit hassle in development environment!
I just want to know if there is a faster way to work with EJB, Maven and Glassfish, like deploying target contents without the need of packaging EAR.
PS: I'm already using "jrebel-maven-plugin" that does hot-deploy ONLY when EAR was initially deployed.
Michel,
why don't you deploy your app from your IDE? I understand that it may take a bit more time to configure development environment, but it really worth the effort. I truly enjoy configuration: Eclipse + m2eclipse + Java EE server.
Download Eclipse for Java EE developers, add plugin m2eclipse(included in Eclipse Juno), import your project as maven project, add application server to eclipse, and run your app on it. Application will be deployed on server by default as exploded archive in less than 10s, what should be huge improvement for you.

How to configure IntelliJ 11 + remote tomcat 6 + maven imported modules?

Here is what I have now:
Imported multiple maven modules into IntelliJ project
Maven targets run OK from the Maven Projects flyout - a war file is created.
Making the project from the "Build|Make Project" is OK too. But here no war is created, just the .class files.
Tomcat 6 running on another machine
Manually deploying the war produced by the package maven goal to the remote tomcat works OK.
A local tomcat 6 instance is configured as an application server. I am not going to use this instance, but the JetBrains documentation says I must have a local instance in order to have an application server configured with the IDE.
No artifacts and no facets are configured for the IntelliJ project.
The remote tomcat is run with JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=1317,suspend=n,server=y
I want to be able to debug my server in the IntelliJ. Which means, that I must have a Run configuration, which does the following:
Produces the respective war file. Making the project does not produce any war, so it should be either modified to produce one or the war should be created as part of a Run configuration. I have no idea which one is the right way.
Deploys or redeploys it to the remote tomcat instance.
Lets me remotely debug the code.
How do I do it?
EDIT
Correction. One of the projects has the Web facet automatically added to it, because IntelliJ has noticed the ...\src\main\webapp\WEB-INF\web.xml file.
EDIT2
Here is my remote tomcat run configuration dialog:
The documentation says I should have the Perform on 'Update' action option in the dialog. Where is it?
EDIT3
I have added Spring support and Spring web services plugins to IntelliJ, since we are using them. Now IntelliJ recognized it and added the Spring facet:
However, there is still no Perform on 'Update' action option in the remote Tomcat Run Configuration dialog.
What am I missing?
EDIT4
The mystery of a missing Perform on 'Update' action option is resolved - How to enable the Perform on 'Update' action option in the remote Tomcat run configuration in IntelliJ?
1) Producing a WAR
To have IntelliJ IDEA produce the war file, you need to have a 'web' facet defined for the module.
Go to File > Project Structure > Modules
Select your module
Add (via the '+' icon or Alt+Insert) a web facet.
Configure the facet. (If you are following standards, the defaults should be OK, but check them.)
Once you have a web facet defined, you can then define a WAR artifact.
Go to the "Artifacts" page in the Project Structure dialog.
You will first need to create an exploded war artifact.
Click the add button
Select "Web Application: Exploded" and then "From Modules"
In the popup, select your module. Verify that the web application artifact is correctly defined. Again, if you are following standards, the defaults should be good.
Once the exploded artifact is defined, click the add artifact button again and select "Web Application: Archie", and then "For {module-name}:war exploded" (or what ever you named your exploded artifact if you did not use the default name).
Verify the configuration.
IDEA will now create a war file when you build.
2) Deploy to Remote Server
You can do this as part of your run/debug configuration. See next section.
3) Remotely Debug
You simply need to create a run/debug configuration to do this.
Go to Run > Edit Configurations from the menu
Click the Add Icon (or type Alt + Insert) and select Tomcat Server > Remote from the pop-up list
Configure the run/debug settings. I recommend clicking the Help button. It will show you what the various options are. (Be sure to pay attention which are available for Local, Remote, or Both.) Take a look at the "Remote Staging" information on the Help page. Also, be sure to select the deployment tab and select the artifact you want to deploy (and specify the context path.) The Startup/Connection tab, "Debug" section will have needed debug connection information that needs to be configured on the remote Tomcat server.
By default, "Make" should be listed in the "Before Launch" section. And once you add the artifact to be deployed, the before launch should also show that the artifact will be built. If not, add it.
Once defined, you can execute this run/debug configuration. To debug, launch using the "debug" button or shortcut (Shift+F9). This will make your project, create the war, deploy it, and then connect the debugger. If you just want to run without debugging, click the Run button, or use the shortcut Shift+F10.

Automatic deployement with Jenkins/jetty

I would like to setup a continuous integration environment whereby after committing the source code, it triggers a build process that checks out the code, runs tests, constructs a war file and deploys the same to jetty server such that the users/testers can access the application on the browser.
Is this possible ?
Am using maven and jetty (I am not willing to change this. I use jetty both for development and in production). For CI, I am exploring Jenkins but am open to other opensource solutions.
If possible, how do I setup the environment.
I found a maven plugin named cargo. It has everything that I needed. I added it into my pom so that I could deploy and undeploy using mvn cargo:deploy/mvn cargo:undeploy. I created a new jenkins job and added undeploy, package deploy maven goals as build steps. Everything is working perfectly.
it's definitely possible. In a previous project, the build server (teamcity) copied the war to a shared nfs location between the build server and the application server and run a little shell script that connected to the application server and restarted jetty.
We used ant inside maven to manage the deployment, I remember we used the copy and sshexec tasks.
I'm sure that there are many other solutions, but that one worked for us.
I reviewed a lot of posts like this but I want something that is maven independent. Look here, this is selfcontained runner in on hudson/jenkins. You only need 'war', even manual jetty installation is not needed. Deploy war on jetty in Jenkins or Hudson job

Resources