I am using Eclipse 3.8.1. I have one project with sources and one which I build.
--ProjectSRC (from svn)
-- src
--main.java
--Project_build (builded project using ProjectSRC files)
--src
--main.java
--build
main.class
I have svn project and I downloaded locally these files but I want to make a new project from them. I am trying to link sources but when I change something in eclipse for example in file main.java in Project_build , another project in eclipse which is linked with the svn do not see changes of this file, so I have to copy changes manually, or to build the project with sources. And if I do that, when I synchronize with the repository there are a lot of build directories and .project files which every time I have to unchecked.
So how to connect sources from one svn project and to create new with them and when a change become to be reflected on the two places, through Eclipse?
Related
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 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 :-)
I have a project ProjectA in Eclipse that is checkout through SVN. What I want to do is remove this SVN project locally and create a new, purely local project also called ProjectA. So I disconnect first, then delete locally, then try to create a new ProjectA. However upon creating this project the connection re-opens!
You could go to the project in you file explorer / outside of eclipse and delete all the .svn folders. If you are using svn 1.7 client or above then you're lucky and have only one folder in the first level of your working copy, otherwise you'll have to delete that folder from each sub directory in your working copy.
Import the project back to eclipse as java project.
I have compiled sources of java web application. I know that project uses maven, because there is pom.xml files inside .war file.
I want to know is it possible to re create maven project using .war file. I use Java Decompiler to get sources, but i do not know how to combine all folders and .java files as it was in original project.
Is there any tool or howto to do it automaticaly?
Here is sources directory tree structure
For information: I do not want to stole some project or code, it's just my work. There is some web app in our production that was done by other developers in 2007. Now we are supporting this projects, and i don't know why customers do not have sources.
Create a new project from scratch as explained in Maven - Guide to Webapps. Then find the src/main/java directory and create a directory structure that reflects packages of classes in the war. Move the resources to resources folder. Use the command mvn package to recreate the war.
You can follow following steps. If your pom.xml is proper
Create a folder say, project
Copy your source code files with package structure intact to project folder( Note: if subfolder should src /project/src .
Copy pom.xml
In eclipse File->Import->select Maven-> Existing maven projects-> select the folder(project)-> Follow the instruction
I will be hosting a java project on SVN which will need to be downloaded by other developers with the ability of that project to be compiled / packaged on their local machine.
I would like to know what files are needing to be stored on SVN and which ones can be left out. I know the files that Netbeans creates can be left out and the build.xml will need to be included as it has code to package the libraries used in the project into the .jar file.
I am assuming that the following need to be stored on the SVN server:
/lib
/src
build.xml
Does any of the files in the
nbproject folder need to be added?
If not what svn commands (IE
svn-ignore) will I need to run to
ignore all the files except for those
in /lib, /src and the build.xml file?
What should my file structure on the
svn look like? Should I keep the
source files in the src directory on
svn or should I name the folder
something else so the developer can
then "Create a new project from
existing source"?
You shouldn't host you lib directory on your SVN, you can use Ivy or Maven as a dependencies manager which will download all your dependency from a repository.
Concerning the netbeans files it depends on the way your team work, I would say that you can let them on the SVN it will be useful for other developers using netbeans and shouldn't bother developers using another IDE.
For the svn:ignore part you have to do svn propset svn:ignore dirname . in command line.
A general file structure is :
/svn
|-projectName/
|-branches/
|-tags/
|-trunk/
|-projectName/ (Sometimes this directory doesn't exists and its content is put right into trunk)
|-pom.xml (Maven !)
|-module1Name/
|-src/
|-main/
|-java/
|-resources/
|-test/
|-java/
|-resources/
|-pom.xml (Maven !)
|-module2Name/
|-module3Name/
Resources :
Apache Ivy
Apache Maven
Subversion - svn:ignore
On the same topic :
Which files should be imported in a subversion repository for a web services project?
-How to ignore a directory with SVN?
I decided to take another route. While I had read your original post about using Maven, we are wanting to stay away from Maven as we are basically just writing a command line interface for an existing library.
Another reason I decided to do what I did was during adding my svn:ignore's I realized that some of the developers here keep their netbeans project settings in different directories which would basically not do any good since it wouldn't be an svn working copy in that dir.
So what I did was just add the /src and /lib directory to the repo.
The end user then checksout the repo with svn co svn+ssh://path/to/repo/trunk . and then will open netbeans and select "Create project from existing source". At which point they will go in and add the library from the /lib directory.
I have Up Voted your answer as it would have been very helpful should I of gone through with using Maven.