Method to run maven command in Netbean - maven

How can I run mvn clean install -Pjnlp command in Netbean 7.3 ?

To activate the profile via Netbeans, you may try the following task: -
Right click at your project and select properties from the context menu.
Select the Configurations from Categories on the left panel.
At the right panel you will see the various profiles defined in your pom. You can Activate them by selecting them and click Activate button or you can create the new on by clicking the Add button.
To achieve your requirement as mvn clean install -Pjnlp is simply just right click at the project and select Clean and Build. The Clean and Build calls mvn clean install together with the activate profile.
I hope this may help.

Related

Intellij Spring Boot project run configuration

I run my Spring Boot project from the command line using mvn install and then mvn spring-boot:run -Dspring.profiles.active="development". This works fine but is not very convenient. I would like to start it directly from Intellij by clicking the green run button.
I tried to add a new run configuration but without success. I set "main class" and "active profiles" and tried to add "run maven goal" but the last one does not work (when I choose the working directory - the one with pom.xml - it says Maven projects not found). What should I exactly set up ? I just want to run the two commands mentioned above from the root directory of the project.
Update: here is the project structure project structure
Please follow the following steps:
Set the maven goal by clicking the "+" in IntelliJ (circled area)
Write mvn install.
Set the VM Options as: -Dspring.profiles.active=development
After that it should just run fine just by clicking the green play button.
This should help you get started.

“Maven Project” option is not showing in Jenkins under New Item section (latest version 2.60.1 for Windows)

Open Jenkins server, go to >> New Item
As i want to work with Maven Project but i cant find 'maven project' option available there.
►To add Maven Project in New Item Page,
just go to Manage Jenkins >> Manage Plugin,
click on Available Tab,
In the filter box enter "Maven plugin" and you will get search result as "Unleash Maven Plugin",
√ enable the check-box, click on "Download now and install after restart"
Below screenshot will help you more-
1) Go to Jenkins Dashboard ->Manage Jenkins ->Manage plugins ->Available ->Maven Integration ->Install
2) Go to Manage Jenkins->Global tool configuration->Maven -> Add Maven_home variable value (i.e. path of the maven file on your system)
3) Go to Jenkins Dashboard -> New Item -> Maven Project option will be available
Here is a latest updates as per Jenkins the Plugin name to installed is changed to "Maven Integration" highlighted below:
PFB

IntelliJ & Maven - mvn command not found

I'm trying to build a drop wizard project created with IntelliJ.
when I run
mvn package
I get
bash: mvn: command not found
I'm on a Mac and I'm following this tutorial: http://www.dropwizard.io/0.9.2/docs/getting-started.html
According to IntelliJ documentation (https://www.jetbrains.com/help/idea/2016.1/maven.html?origin=old_help)
Maven integration is shipped with IntelliJ IDEA, and you do not need to perform any additional actions to install it. You can start using it straight away for importing Maven projects, working with them and for running Maven goals.
So I don't know what I'm suppose to do in order to use the command line
Any idea?
Thanks
In IntelliJ, on the right hand side, click "Maven", and expand "Lifecycle"
Select "Package" and click "Run" (green arrow).
mvn is the command line tool for Maven.
See https://maven.apache.org/install.html for details on how to install it.
Or as you are using a Mac if you use brew try using it to install the maven formula.
If you have maven properly installed and you want to configure intelliJ terminal with a custom Terminal or if you want fix "command not found",
follow these steps:
Click > File
Click > Settings
Click > Tools
Click > Terminal
Edit "Shell path" # "Application Settings", if you use git bash change current path with:
C:\Users\Work\AppData\Local\Programs\Git\bin\sh.exe --login
// The path you may have differs based on your OS, in example: "installationPath\Terminal Folder\bin\sh.exe --login"
Click > Apply
Click > Ok
I used git bash but technically it should work with every terminal. Do not forget to add --login after the *.exe
If it still doesn't work maybe you need to check:
Click > Environment variables
Click > System Properties
Click > Environment Variables
Click > System Variables
Select > Path from the list
Click > Edit
Click > New
Insert the path of your maven bin folder, in example:
"installationPath\apache-maven-3.8.6\bin"
Also insert the path of your jdk, in example:
"installationPath\Java\jdk-18.0.1.1"

Jenkins plugin shows on Plugin page but does not show on configuration page

I am creating a hello world plugin for Jenkins by following Tutorial: Create a Jenkins Plugin to integrate Jenkins and Nexus Repository. After I followed the steps, I can run Jenkins and test the plugin.
It shows on Installed Plugin Page.
Then I go to Configuration page and expect to see Hello World Builder section like the below image, but there is not.
What steps did I miss? Is there anything I have to do before having that plugin show up on the configuration page?
Update
This is the project layout, I haven't modified anything on it yet.
What command did you use to generate the plugin skeleton?
FYI, from the tutorial above, mvn -cpu is deprecated.
To generate the plugin skeleton, use:
mvn hpi:create
or
mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create from the Jenkins Plugin tutorial
I'm going to include each step for what worked for me:
mvn hpi:create, then enter groupId (press enter to use default: org.jenkins-ci.plugins) and artifactId (name of the plugin)
cd new-plugin-name
mvn eclipse:eclipse
mvn package
mvn hpi:run
(default port is 8080, but you can set your own with Dport option (i.e. mvn hpi:run -Dport=9999, use this if port 8080 is in use - otherwise mvn hpi:run will fail)
Open browser and enter URL "localhost:8080" (or 9999)
You should the page below. Click the link and that'll take you to Jenkins home page
Click 'Manage Jenkins' > Configure System. Scroll down near the bottom of the page and you should see the Hello World Builder section
Go back to Jenkins home page and click New Item
Give the project any name, select Freestyle Project, click OK.
Scroll down to the Build section and click 'Add build step' > Say hello world
Enter a name (i.e. TestName), save the project, then run a build ('Build Now')
Click on the latest build under 'Build History' > Console Output.
I had a same problem and solved it.
I am sure you are using eclipse as IDE and imported HelloWorldBuilder as a maven project.
In my case, I converted it to eclipse project after deleted and regenerated again.
Please refer "Setting up a productive environment with you IDE" section of the following url and use this command.
mvn -DdownloadSources=true -DdownloadJavadocs=true -DoutputDirectory=target/eclipse-classes -Declipse.workspace=/path/to/workspace eclipse:eclipse eclipse:add-maven-repo
https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial
If you launch the project after convert and rebuild it, the hello world builder section will be shown in your jenkins configuration menu.
I recently had the same problem. Apparently currently (see date of this message) master of the hello world example is wrong. I needed to change
<artifactId>hello-world</artifactId>
to
<artifactId>hello_world</artifactId>
because some component in the middle doesn't accept "-". I think hpi:create will tell you that, unfortunately the debug log files don't. But the existing hello-world should already have those things correct.
Even I faced same problem, I think reason is because I imported to eclipse as a maven project. I deleted folder and ran command
mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create
to create new project. Then ran mvn hpi:run and it showed up well.

applying mvn commands via intelliJ IDEA

How to run following mvn commands via intelliJ IDEA? I can run these commands from terminal but how to do the same in the IDE for the project opened in it?
--mvn clean dbmaintain:updateDatabase
--mvn clean package
Go to "Edit Configuration" and create a new "Maven Run/Debug Configuration". There you can define the command line and the working directory.
An other way of doing the same is : open de maven projects view (on right edge of the window) expend your module, expand the "Life-cycle", select the phase you need to run. Then a simple rigth click shows a popup allowing you to "run" the phase or create a run configuration preconfigured with the working dir and the phase. (you can always edit it)

Resources