My Maven project in IntelliJ Idea have no resources folder both in main and test folder. I know how to manually create those folders and update pom accordingly, but how can I do it automatically in IntelliJ Idea? In Eclipse there is an option like "Update project".
First you want to right click on your project and choose "Add Framework Support" to allow Intellij to recognize that this is a Maven project. Assuming that you have your pom.xml ready, right click on it, hover over on "Maven" choose "Reimport" and/or "Generate Sources and Update Folders"
Related
I am trying to create a .JAR out of my JavaFX project to then convert it into an .exe file. But IntelliJ doesn't show a "build artifacts" option in the main menu, which the guides I've seen require me to click. Build only gives me the following options: Recompile Main.java, Build Project, Rebuild Project 'Project Title'. Any help is appreciated
I've already created an artifact in the project structure tab.
You must define an artifact in File > Project Structure > Artifacts. Once defined you can generate your final file under Build > Build artifacts > your_artifact
I leave you an example that I'm actually using
It looks like your IDE menu is customized and some of the items were removed. It should help if you either reset the menu to the defaults or add the missing items manually:
I have a multi-module project in my IntelliJ environment. I want to create and deploy war for only one module in apache tomcat. (IntelliJ comes with default installation of tomcat.)
I have worked almost four years with Eclipse and started with IntelliJ like three days back. Just the way we right click on the project in eclipse and say export as war and it directly deploys in my app server, can I do same / similar in IntelliJ?
Any help will be helpful.
Thanks
PS : may be stupid to ask but would mac / windows make difference?
This absolutely works!
First:
Wow, I was reading and trying the answers provided and i couldnt believe why no one mentions the root of the issue which is "NOT MENTIONING THE WAY YOU WANT YOUR OUTPUT TO BE" which is war so lets first tell intellij what we want by adding bellow tag to your pom.xml
<packaging>war</packaging>
where to paste? anywhere inside <project> tag
Now lets talk about the method
You can install "Maven Helper" plugin as it will help beginners nicely, but if your intelij has a good handshake with maven, it will automatically or manually refresh your project and add the war capability to your maven settings ( the panel you see at the right hand side of the editor that mentions Maven) there you click on Plugins and you should see now you have war (org.apache.maven.plugins:maven-war-plugin:xxx) as you click on the + you see many options, war:war and war:exploded are your friends to do what you like
<!-- Package as an executable jar/war -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
Use clean to dust off the previous mess, use war:war to create .war file, and for manifest war:exploded will do, if these didnt help for manifest, use the
File | Project Structure and click Artifacts.
Click Add + and 'Web Application:war exploded' then it will pop-up your project and select it and hit OK and then go and do Build > Build Artifact.
Good luck.
IntelliJ has different process to build war:
Goto -> Files -> Project Structure -> Artifacts
In artifacts tab, you will see a small + button on top right corner.
Click it and fill up the right panel data such as name and output directory.
Make sure to create the Manifest file. Keep default location for Manifest file.
After building manifest, click apply->Ok.
Now you can go to Build-> Build Artifact.
Your .war file will be ready in the output folder you specified above.
you can use maven build to create war file.
Go to right maven -> Lifecycle -> double click package. You can see your war generated default directory i.e Target
It took me a while to realise that you can't build a war file with intellij community edition, at least I could not do it looking at answers from this thread.
My approach was to download and activate "Maven Helper" plugin directly from the IDE ie. File->settings->Plugins.
Then, select your pom.xml in the project viewer and in the "Run" tab, you will be able to choose Run new Maven Goal.
There simply add the command line "clean install".
Your war file (if you selected war in your pom.xml file) will be located under the folder "target" in your project main folder.
File | Project Structure Ctrl+Shift+Alt+S and click Artifacts.
Click Add + and create a Web Application: Archive For 'Web Application:war exploded'
Build | Build Artifacts > Web Application: war > Build
You should see the artifact <project >/out/artifacts/Web Application_war.war
GL
Source
Step-1
Step-2 Step-2.2
Step-3 Step-3.2
Step-4 Step-4.2
Result
07/2022
File | Project Structure Ctrl+Shift+Alt+S and click Artifacts.
Click Add + and select 'Web Application:war exploded' click 'From modunles..' and select Modules
Click Add + and select 'Web Application:war Archive' click 'Modules:war exploded'
Build | Build Artifacts > Web Application: war > Build
You should see the .war file in 'out/artifacts/'. And you can use it to deloy onto the Glassfish Server
I have a folder at the root of my Eclipse Java project to hold configuration files for the application and log4j2. The only way I can get the in IDE build to work is to add that folder to the Java Build Path of the project.
I need to exclude either this folder or the files therein from the JAR file export. This will allow it to look in the same folder for those 2 configuration files.
Right click on the project folder in the Eclipse Package Explorer.
Select "Build Path", then, "Configure Build Path".
Go to the "Source" tab that appears. (You should be automatically selecting "Java Build Path" in the left hand side of the popup window)
Open the folder for your project, and click on "Excluded", then click "Edit" on the right hand side.
From this window, you should be able to click "Add..." in the exclusion patterns. The dialogue box should have a "Browse" button that will allow you to exclude specific classes or packages. The input also accepts wildcards.
You could pack your dependencies project into jar(wihout excluded files). Then pack as previously.
I have two different eclipse plugin projects and I want to call to class from proj1 in proj2,
what are the steps that I should do?
I have tried to do it with adding a project proj1 to project2 with the tab right click on project properties and in the tab project ,without success .it doesnt know it?
If you're working with plug-in projects, they can only rely on other plug-ins and .jar files according to their plug-in manifest files. Open proj2's MANIFEST.MF file in the Plug-In Manifest Editor and add proj1 as a Required Plug-in from the Dependency tab.
Sometimes Eclipse get confused or does not use your changed configuration by itself.
Often it helps to force eclipse to build all projects again.
Main menue: 'Project' than click on 'Clean ...' select 'Clean all projects' and press 'OK'
I downloaded and extract jmeter's source code: http://jmeter.apache.org/download_jmeter.cgi
How do I go about opening this project in IntelliJ?
I tried to 'open project' and navigated to the directory, but it doesn't seem to pickup any of the files to open the project.
Do I have to import or something?
Create a new project over existing source--you can't open a project when there's been no project set up.
IntelliJ will pop up a window with the source directories it discovers; by default they'll all be checked.
You can add the Ant build file in the "Ant Build" tool window to make Ant builds easier.
UPDATE
Since JMeter 5.2 it uses Gradle instead of ant, you can easily import the project into IntelliJ like so:
You require IntelliJ 2018.3.1 or newer.
Open the build.gradle.kts file with IntelliJ IDEA and choose Open as
Project Make sure Create separate module per source set is selected
Make sure Use default Gradle wrapper is selected
In the File already exists dialogue, choose Yes to overwrite
In the Open Project dialogue, choose Delete Existing Project and Import (if IntelliJ project already exists)
ORIGINAL
These are the steps I followed to get the JMeter source code into IntelliJ. I've included some screenshots on my blog.
Import project from Git: https://github.com/apache/jmeter.git
Select "Create project from existing sources"
Name the project
Select all source file directories
Deselect any libraries, (add them later)
Select all of the discovered modules
Select the SDK (you might need to add one if you've not used IntelliJ before)
Press Next and then Finish
Click the "Ant Build" menu in IntelliJ
Press add and add the build.xml file
Run the download_jars target
Open project settings (Ctrl+Alt+Shift+S) then add the downloaded jars to the project
Notes:
You can compile and start the GUI by executing the run_gui ant target
If there are any errors in IntelliJ when viewing files (or pressing build project) you can usually solve them by pressing alt+enter on the offending code and making the appropriate 'module' a dependency - however this shouldn't stop you developing or running things via ant.
I've also created a screencast of the above steps:
https://youtu.be/r0Z79PjEb80