I want to create a project in eclipse in which the following directory gets generated automatically.
src/
tests/
projects.xml
meta-src/
So under which category this project will be falling. I was creating maven project. But it will be having lot more directories. So is there any specific project under which this will be falling? Or I can simply do Java project and keep on adding necessay files and directories?
Java project should be fine, you can set up auto-save actions etc no matter what the project type I believe.
Related
I have the below Web project which is working fine. I wanted to change the structure of the project into a maven project structure.
So, I modified the project to as shown below(I created a new folder called webapp under src/main and I moved the contents of the folder WebContent into webapp and I deleted WebContent folder) Now the application doesn't work although I deploy it in the Tomcat Server. What is wrong in the below project structure . Please help me out
EDIT: I wanted a maven project structure as shown below which is a standard maven project structure
If you are using eclipse (which it looks like you are), you can use the M2Eclipse plugin, which will provide a "convert to maven" utility. Simply right click the project and go to configure -> convert to Maven.
https://www.eclipse.org/m2e/
The structure you are looking for can be defined at the time of project creation in the source directory screen. If you have an existing project you will need to add a new source folder.
To do so,
Add the folders to your project.
Right click on folder > build path > use as source folder.
We have a Java project that was modified about 2 years ago based on the dates.
The project uses a the Play Framework which as I recalled built and ran just fine back in 2012.
The developer apparently had tried to change the project to be a Maven project but the folder structure is all over the place and not within the Maven src folder structure.
Attempting to run the Play commands does not work on building the project any longer and using the Maven commands does not compile the code.
What occurs is just the packaging of all of the folders and source code into a .jar file.
So the question is 'Can files outside of the Maven folder structure get compiled?' if so how, OR do I need to restructure all the code to be placed into the proper Maven folder structure to try and get this to work again?
Thanks for your time.
Rough view of the folder tree below: Unable to post the POM as it is on another system
Project Name
src
main/java/
trunk
Project Name
... play framework folder structure in here eclipse, modules, precompiled, tmp
conf
lib
Web Content
META-INF
WEB-INF
Yes you can compile files in a non-standard Maven folder structure. Maven natively supports multiple source directories for the purposes of generated sources.
Read the Maven use guide When You Can't Use the Conventions
Using Multiple Source Directories This occurs when you are producing a
single JAR (or other artifact), and have several source directories
with classes you want to include.
This answer shows how to edit the directory structure in Maven by specifying the appropriate properties to override from the superpom.
The Maven pom docs show the build element set mentioned in the link above.
As a side note this answer covers a non standard directory layout for building war.
I'm working with huge project which has almost hundred plugins which in turn has it's own folder. The issue is that this project was created in eclipse and for each plugin's source folder a corresponding output folder specified. I'm wondering if it is possible to do the same thing in intellij or I'm forced to use eclipse?
Just some screenshots to make thigs clearer:
In the project structure you can create an artifact for each of your library an specify an output directory.
Try File->Project Structure then in the Project Setting add new artifact and specify output directory
I accidentally converted my project to Maven by going to Configure > Convert to Maven Project. Now I want to undo this. I read that I need to right click Maven > Disable Maven Nature and that worked fine. However I want to totally remove Maven, so I deleted the pom.xml and the target folder. When I try to run my code now, I get the error:
Error: Could not find or load main class
So what am I missing? How do I revert from a Maven project to a non-Maven project?
When you convert a Java project to a Maven project in Eclipse, the Maven Integration for Eclipse (m2eclipse) configures the Java incremental compiler to put the compiled class files in the same location as Maven would put them, i.e. target/classes.
So when you remove the Maven nature and delete the target folder, you now also have deleted the compiled class files and your project can no longer run. AFAIK, the incremental compiler doesn't detect when you remove its output files, so you need to trigger a rebuild by cleaning the project (Project > Clean...)
This will fix the problem that you can not launch your project, but may re-create a target folder. If you also want this to be "fixed", you can switch back to some other folder name for the binaries, e.g. bin, in the project's Java Build Path configuration on the Source tab.
Is it basically a Maven project, i.e., do you have and maintain it through a pom.xml? Then my suggestion is to delete the project in Eclipse but keep the files on the disk (i.e., it removes it from the workspace). Then, run a simple mvn eclipse:clean eclipse:eclipse which creates a simple Java project without the Maven nature based on the POM (so the libraries are linked and the source/output directories are set up correctly - this may solve your ClassNotFoundError).
If it's a simple Java project, I would advise deleting it from the workspace, removing the .classpath and .project files and importing it again with the Create a Java project with existing sources wizard.
Either way, make a backup of your project before you start doing anything :-)
Recently I was forced into using Eclipse because of TFS plugins:
I have a few projects that I'm converting to Eclipse projects from Netbeans. Some of these projects reference each other. After starting to convert these projects I quickly found that Eclipse doesn't want to jar projects post-build. So I used an build.xml and created a new 'builder' for each project (whose bright idea was it to not allow me to reuse builders across multiple projects?). After I got all that working I was sitting back thinking about how I would go about building for deployments, and it occured to me that eclipse is not including any of the referenced assemblies in the build output directory. This sucks, because manually creating lib folders and copying over all of the jar files which are required will be error prone, and time consuming. So heres the question. Is there any reasonable way to set up a builder, or property on an eclipse project such that when I build it, it will create a 'dist' directory, containing both the jar'ed project classes, and a lib folder with all of the referenced jars attached to the project?
Is there any reasonable way to set up a builder, or property on an eclipse project such that when I build it, it will create a 'dist' directory, containing both the jar'ed project classes, and a lib folder with all of the referenced jars attached to the project?
Yes, right-click on the Project and select Export. Type "jar" into the search box and select Runnable JAR file. In the export dialog, select the "Copy required libraries..." option. There should also be an option there to save this export as an Ant script.
I dont know how to resolve a list of dependencies using ANT
Next, you should consider using Ivy. This will add dependency management to your build script. There's probably some learning curve here, but these tutorials should help.