I would like to create a 'site' containing test reports for my Maven Java project. However, all the online resources that I found were talking about the command 'mvn site'. I do work on Windows, though, therefore I would like to avoid any interaction with its console.
Can I do it using solely the Eclipse Maven Plugin? If I want to tell Maven to build my project, I can right-click it and then choose 'Run As' 'Maven Install'. Is there something similar for generating sites?
Thank you all in advance!
Why the hate for specifically the Windows command prompt? What has it done to you to deserve a cold shoulder?
In any case and more seriously: Eclipse allows you to define run configurations yourself. run -> run configurations. Under "maven build" you can add a new configuration to do a mvn site. This page gives an idea by demonstrating how to do a clean install:
http://books.sonatype.com/m2eclipse-book/reference/running-sect-running-maven-builds.html
Related
I am currently working on a project that involves utilizing Gephi's backend tools and frontend visualizers. For this, I have cloned Gephi's repository, https://github.com/gephi/gephi.git. The following tutorial walks users through how to clone and modify Gephi's sourcecode so that you may add "circle creation logic" to Gephi's visualizer, https://seinecle.github.io/gephi-tutorials/generated-html/working-from-the-source-en.html. I have found that running the project through NetBeans is a straightforward process, build the dependencies and run.
Unfortunately, such an option doesn't exist in IntelliJ and the maven "Lifecycle" goals that I can run (clean, validate, compile, test, package, verify, install, site, and deploy) build successfully, but does not actually run the project within the environment unlike NetBeans does. I am wondering what I am missing here, or how NetBeans can simply run the maven project node, but such an option doesn't exist in IntelliJ? How do I perhaps edit my run configuration within the IntelliJ IDE so that I can run such an instance?
The equivalent in IntelliJ IDEA would be the following:
Run the compile goal
Run nbm:cluster-app
Run nbm:run-platform
The last 2 goals are provided by the nbm Maven plug-in.
In IntelliJ IDEA they are visible under the Plugins node of the module in the Maven tool window:
Case in question: A Maven based project that has a Maven Run Configuration with its 'Command line' parameters defined as clean install.
Clicking the green arrow to invoke 'Run my_maven_config' downloads all necessary packages from Nexus and completes the build successfully.
Selecting 'Build Project' however, invokes a seemingly similar process but after building successfully for quite a while, it fails on a missing Hibernate package.
Why is this difference?
Shouldn't the build part of 'Run' be identical to the "standalone build"?
They are not identical. IntelliJ IDEA imports the external project model from Maven and converts it to the internal project model. It's not 100% accurate, some Maven plug-ins are not supported, some dependencies may fail to resolve, etc.
See this answer to perform the diagnostics. Try re-importing the project (delete .idea directory first if it doesn't help).
Delegating build/run actions to Maven as it can be done now with Gradle will be supported later (probably in IntelliJ IDEA 2018.3).
Now IntelliJ IDE allow to delegate Build actions to maven.
Go to Preferences and search for "Delegate IDE build actions to maven".
So when you build a project, IntelliJ IDEA invokes the appropriate Maven goals.
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).
What is the command that m2eclipse runs when you
highlight a project -> Menu Project -> Clean -> Select anything -> Ok ?
It then goes on to "Building Workspace".
What is the command that allows it to do so?
The reason I am asking is that I am trying to do this from outside Eclipse, from the command line. I am trying to automate all maven stuff in a Groovy script. I am on Windows xp.
EDIT:
Also, the command update maven dependencies would be nice to have as well.
Thanks!
Maven-invocations are put in the Run and Debug menus. Just building the workspace does not run maven - it just does all the work Eclipse needs to do to know your files.
For your purposes these will suffice for the command line build:
cd /to/where/pom.xml/is
mvn clean
mvn install
No commands are directly run. Instead, the m2e plugin uses the configuration in the pom to create equivalent configurations in eclipse.
For example, if you change the source directories it will update the eclipse source directories for the java builder. If you change the target directories for the source compilation, it'll ensure that when you do a Project -> Clean, the plugin knows which directories to clean.
If you are trying to do this though a scripting language, I would recommend just running commands on the command line. The alternative would be to add the maven libraries to the classpath and to use them.
I know it must be something simple, but I just can't figure it out..
I'm using the Sonatype maven plugin on eclipse. When I want to build a war file for a webapp project, the only way I know to do it is to use the command line and type mvn package.
I've looked all through the right click menu and I can't find any way to do it from eclipse.
There's a maven submenu that seems to have no options to do with building, and there's a run menu that doesn't seem right - I don't want to run my project - I just want to build it. There is a maven build option in the run menu, but if I run it, a configuration window pops up for me to enter goals in..
How I do I just do a simple mvn package, but through gui? What am I missing?
Thanks!
Thanks guys!
Both responses answer my question..
Now I have new problems that the build doesn't work, but I'll post that in a new question.
Take a look into the menu under that "Run As" there you find "Maven build" with a dialog where you can define different goals etc.
If your project is a Maven project, right-click on your project and select Run As > Maven Build to create your own configuration (goals, profiles, etc) or use one of the preexisting configuration.
http://www.imagebanana.com/img/ja7wh7m0/screenshot_008.png
Once you've run a Maven Build Run Configuration, it will also be listed under the "Run As..." green arrow:
alt text http://img8.imageshack.us/img8/8510/screenshotrun.png
You could add it as favorite if you want.