1

New to maven - I have an eclipse project that I can Right click > Run as... > Run on server and it runs successfully on my local Wildfly installation. Is there a way to RClick> Run as... and choose an appropriate maven goal to achieve the same effect (ie package as a war, copy to the servers dir (re)staring the server) ? Do I need to use a "wildfly maven plugin" ?

Similar question for tomcat: maven deploy goal failing

I am on eclipse Luna Java EE pack, maven 3.1 (the one that comes with eclipse) and using Wildfly 8.1.0.Final

Related:

EDIT: I am now on Wildfly - so I edited accordingly

The closest I got was:

<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>1.0.2.Final</version>
    <configuration>
        <jbossHome>C:/_/wildfly-8.1.0.Final</jbossHome>
    </configuration>
</plugin>

but I would like to avoid hardcoding the path there - how should I proceed ?

Community
  • 1
  • 1
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
  • Let me know if this could help: https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html this for an overview of the plugin: https://docs.jboss.org/jbossas/7/plugins/maven/latest/deploy-mojo.html – ivoruJavaBoy Jun 17 '14 at 12:41
  • @ivoruJavaBoy: this direction I guess - but I need to be able to run it from eclipse (via a maven launch configuration) – Mr_and_Mrs_D Jun 17 '14 at 13:21
  • Maybe there is something that I do not understand... but cannot you run directly from Eclipse this goal: mvn jboss-as:deploy? – ivoruJavaBoy Jun 17 '14 at 13:37
  • I am new to maven - I have not set up any jboss plugin - in eclipse all I have to do is set up a Jboss _runtime environment_ - then hit "Run on Server" - no clue how this translates to maven launch configurations – Mr_and_Mrs_D Jun 17 '14 at 13:44
  • Ok...now i understand...Take a look at this discussion: https://community.jboss.org/thread/155668?tstart=0 i see that everyone use a different configuration... Try also this http://stackoverflow.com/questions/5842560/how-to-deploy-war-of-maven-project-to-jboss-server-from-eclipse – ivoruJavaBoy Jun 17 '14 at 13:51
  • @ivoruJavaBoy: thanks - had seen this but didn't bother - first is not answered + it's for eclipse Helios (ancient history) - as for your secongd link - his solution is to directly export the war in the server (duh). Had seen this too – Mr_and_Mrs_D Jun 17 '14 at 13:59
  • 1
    I'm sorry...this is my way of finding soluctions... try to look for! This time it does not help :) when i'll have more time..i'll look better! – ivoruJavaBoy Jun 17 '14 at 14:05
  • @ivoruJavaBoy: thanks - this my way too (I've seen all links apart the first one already) - but then ask :D – Mr_and_Mrs_D Jun 17 '14 at 14:20
  • You can "run on server" (at least now you can) with a maven war project from the Java EE perspective. When you create it, it should already have the Dynamic Web Module facet added. –  Aug 04 '15 at 01:14

1 Answers1

1

You can use jboss plugin

        <plugin>
            <groupId>org.jboss.as.plugins</groupId>
            <artifactId>jboss-as-maven-plugin</artifactId>
            <version>7.5.Final</version>
        </plugin>

Then set goal as: “jboss-as:deploy clean”

It will deploy war on JBoss server.

Neeraj
  • 327
  • 1
  • 8
  • Thanks - will test this - meanwhile could you point me to the docs ? Is `7.5.Final` the latest version ? Is it valid for wildfly I moved to since ? – Mr_and_Mrs_D Jul 10 '14 at 17:17
  • For Wildfly you need to use different plugin. but It will work as above. You can find it here https://docs.jboss.org/wildfly/plugins/maven/latest/ – Neeraj Jul 11 '14 at 06:45
  • Hmm - this downloaded the wildfly server again :D - I am interested in running this from inside eclipse - have a maven launch configuration which will deploy to the server runtime eclipse knows about and run it. Any way ? – Mr_and_Mrs_D Jul 15 '14 at 01:16
  • I tried to use WildFly plugin and it is working fine. It is downloading required jars only for first time. It deployed war on server successfully. I mentioned in maven-war-plugin to generate war in server deployment. – Neeraj Jul 15 '14 at 09:40
  • For it me it failed - will look further - but my question was if it could use the existing wildfly install (eclipse knows about) - is where the `` comes in ? Thanks for keeping me posted btw ;) – Mr_and_Mrs_D Jul 15 '14 at 12:36
  • You can use System_Env variable in configuration use ${JBOSS_HOME}. Set JBOSS_HOME to your jboss directory in env variable. – Neeraj Jul 16 '14 at 06:25
  • Accepting your answer - although I have more questions - namelly how to make the plugin "play" with the servers view of eclipse. Oh, well – Mr_and_Mrs_D Jul 30 '14 at 10:42
  • Thanks for accepting answer. For other question I am not sure what it means. :( – Neeraj Jul 30 '14 at 12:17