How to run maven project on jetty in Intellij as in Eclipse? - java

Maven project (project name: english) [vaadin, jetty] runs in Eclipse without any problem. How to run/configure exactly the same project in Intellij? Run/Apply options are not available after below configuration. In Eclipse I set, Base directory [${workspace_loc:/english}], Goals [jetty:run], JRE, Source (english project). How to set it in Intellij?
eclipse1
eclipse2
eclipse3
intellij1
intellij2

First things first, you need to add jetty plugin for maven as a dependency, if you don't have it already in your pom.xml. More about jetty maven plugin can be found here
If you were running the project via embedded jetty plugin in eclipse, same pom.xml configuration should run successfully run when you issue same command in intellij IDE.
If there are any issues on your build, try with a "clean rebuild" before you start doing anything else. You can do that via the following command in your terminal:
mvn clean install jetty:run
You will need access your console (terminal), i.e. via Alt + F12 keys. You also need to be in the same directory that you have the pom.xml in your project.
The command will basically clean up (i.e. delete) previously build project and do a fresh rebuild of your project, then run it via embedded jetty plugin.
Be sure to read a brief introduction to maven commands: Maven in 5 minutes if needed.
After you successfully issued this command for the first time, I think you can can also issue jetty:run via View -> Tool windows -> maven project.
You can usually access it also on your right side of intellij IDE (the "m" icon, maven projects).

Related

maven build on jenkins not allowing to create/genarte any files in project

I have created a java project which has implemented cucumber and Junit.
When I am running the project from my IDE the reports and snapshots are generating finely but after pushing the code when my build is run by Jenkins, none of the reports and snapshot is generating in my workspace. My build also showing success without any issue, just the files are not created.
Configuration :-
Window 10
Jenkins.war -> Jenkins ver. 2.74
I am using the below command from terminal which is working fine
mvn clean install
In Jenkins maven plug-in, I have set goal as
clean install
I have also giving Full control permission to Jenkins war from properties->security.
It looks like a permission issue to me but what exactly it is?
I have also change the workspace from c driver to d still facing the same issue
In configure -> build -> Root POM, the path of POM file should be of your Jenkins workspace projects not of your local/development env

How to build with Maven and deploy to Wildfly 9 in IntelliJ IDEA Ultimate

I'm using IntelliJ IDEA Ultimate 2016.3.2 as my IDE, and I would like to create a run/debug configuration that builds my Java 8 app with Maven, and deploys it to a local Wildfly 9.0.1 standalone server.
So far I have managed to create a configuration that deploys a .war from external source to the Wildfly with debugging, and it works as intended. The external source points to a .war that i manually build with Maven through a command line.
This fulfills my needs, but I would like to include the maven build in my run/debug configuration, to simplify the process.
I need to pass some arguments to my mvn install command.
How can I include the Maven build with arguments in my run/debug configuration in IntelliJ IDEA?
I ended up adding an execution of a Maven goal to the run/debug configuration. Under the "server" tab, I added the Maven goal, which lets me execute my Maven command in a specified directory, to the "before launch" list. I removed the IntelliJ "build" from the list.
The deployment is still an external source pointing to the .war which is now build as part of the configuration.
This works for me, but if anyone has a better approach, feel free to add it.

Eclipse configuration to launch a Maven project with Google Web Toolkit

I'm starting a GWT project with web creator as following:
C:\>webAppCreator -noant -maven -overwrite -out MavenTest com.raphiki.MavenTest
It generates a Maven project's structure with an GWT Hello world project, I import this project in Eclipse as a Maven project with existing sources.
Then I enable Google Web Toolkit in my project, and I need to give a WAR path. I try with the /src/main/webapp which contains the entry point, but when I launch the app I get a ClassNotFoundException on Hello world's class's package.
See the following image which is the structure the WebAppCreator built:
Did I miss any configuration to do?
See http://web.archive.org/web/20130619170526/https://developers.google.com/eclipse/docs/faq#gwt_with_maven
TL;DR: run mvn package (or mvn war:exploded), then run DevMode, choose target/myapp-1.0-SNAPSHOT/ as webapp directory.
I can't speak for the webAppCreator because I haven't used it, but I have had good luck creating the Maven projects in Eclipse using the gwt-maven-plugin from codehause.
Creating a Maven GWT Project Directy in Eclipse
Open the new project wizard in Eclipse and filter on Maven Project.
Select the Maven Project and click next.
Enter the project location of your preference and click next.
Enter "gwt-" into the archetype filter and select the gwt-maven-plugin from codehaus. Click Next.
Enter your maven project details and a module value, then click Finish.
This will create a maven - gwt project for you in Eclipse. This comes with a sample application that you can use to make sure you can launch the application correctly.
Running the Application Command Line
Open command line.
Navigate to your project home.
Run the command "mvn clean package".
Run the command "mvn gwt:run"
This should get you up and running. If you used the 2.7.0 gwt-maven-plugin this should run the application in super dev mode by default.
Run the application in Eclipse
As you have done, navigate to Properties > Google > Web Application and check "This project has a WAR directory". The WAR directory using this plugin should be src/main/webapp.
Navigate to Properties > Google > Web Toolkit and check "This project has a WAR directory. You may be able to specify the module here. I am actually unable to do so, it may be specific to my Google Plugin for Eclipse or something environment specific...
Run As > Web Application.
If you had issues, as I have had, in step 2 then you will get an error Missing required argument 'module[s]'. To fix this open up your run configuration (should have been auto created) and in the arguments tab add the package qualified name for your module at the end of the arguments, e.g. com.mycompany.abc.GwtSampleModule. Do not add the ".gwt.xml" prefix.
It's worth also checking that the HTML page referenced in your arguments is correct, I have also had issues with that.
The application should now be configured for Launch in Eclipse using this run configuration. My verified environment is:
Eclipse Luna (v4.4)
Google Plugin for Eclipse (v3.8)
GWT Maven Plugin (v2.7.0)

Eclipse maven build does not install dependencies

I'm working in eclipse on a java / javascript project, we're using maven to manage our project dependencies, I ran into a issue with maven build (clean install) does not install the dependencies that I specified in the POM.xml file, I tried everything I can find on the internet the whole day today, still no luck, I'll be really appreciate if anyone could kindly take a look at, thank you :)
I got a reuse lib project (lib) and a working project (project), the project should be installing the lib during the maven build, So, here's more detail information on what exactly I did:
I ran maven clean on the lib, then ran maven package, the lib-1.0.0-SNAPSHOT.jar file was generated successfully.
then in the working project POM.xml file, I added the dependency declaration.
I right clicked the working project, maven -> update maven project, where I checked the 'force update of snapshots / releases' checkbox, then -> ok
I right clicked the working project, run as -> maven build (with clean install, and also I checked on the 'Update Snapshots' checkbox) -> apply -> run
In the console, I saw the reuse lib was downloading and then downloaded, but it's never got installed (there should be a line says installing reuse lib...), as the result of it, the reuse lib will not be loaded after I ran my working project, it drives me insane -_-!..
Only your maven projects build output can be installed (in the local repository with mvn install, resp. mvn clean install). During the build it will resolve the dependencies (and the transitive dependencies) to be downloaded and packed to your delivery. Those dependencies of your project will implicitly also be "installed" in your local repository since you will see them in your local repository after the download happened - Maven will however not see that as a install in the meaning of install of the default lifecycle.
To install your "reuse lib"-Maven project you will have to run mvn install or mvn clean install on that project's pom rather than on a project which "just uses it as dependency".

how to use maven (eclipse keppler) on imported non-maven projects

I have existing projects that I wrote using Eclipse Juno on another machine, on that machine I downloaded the jars I needed (selenium, jxl, sqlite etc.) from the internet manually and then edited the build path to point to them. I need to move these projects over to a different machine which has Eclipse Kepler loaded. I thought I'd use maven to link everything up (with a view to retro-fitting the machine with Juno to use maven) so that as I jump between the two machines everything will be kept in order automatically.
I installed maven from the marketplace and ran the install:install-file command, but it won't run the program as it insists the jars it's looking for aren't installed (which of course they aren't, that's what I thought maven did).
Is it not possible to use maven in this way (get it to download and link up missing jars) for an existing project? Do I need to do it manually, and if so will I have created problems that I'll have to unpick by having tried this with maven?
If you're using the m2e plugin, you can turn on Maven dependency resolution by just right-clicking on the project and choosing Configure->Convert to Maven project. Make sure your project has a valid pom.xml file and set everything up properly in Preferences->Maven (proxy, user settings, maven installation, ...)
If you're not using m2e, you can use the eclipse maven plugin like this:
mvn eclipse:eclipse
This will call the eclipse goal of the eclipse plugin, and it will generate .project and .classpath files for you with all dependencies pointing to your Maven local repository.
As a side note, the install:install-file goal doesn't have anything to do with what you want to achieve, it's used to install an artifact (a .jar file) to your local Maven repository.

Categories

Resources