Closed ruckc closed 9 years ago
This is great! I also suggest:
Hi @ruckc ! Thank you for your contribution, I've not worked with maven before so please give me a bit to download maven and make sure everything works out. I will get back to you shortly, please bare with me. :D
Maven and support for it is actually built into all latest versions of Eclipse
Hi @eugener so it is possible I can keep my existing jar descriptions and support both? Just let me make sure it still builds alright. Can someone clarify the reason for the inclusion of the Google checkstyle guidelines? I use the XML formatter imported in Eclipse I am not sure if this is a duplicate of that or something else I hadn't considered.
Yes... it will support both. The reason for maven and other tools is that not everyone is using Eclipse. In fact most people don't. You also need to be able to build your project from command line for CI purposes Let me know if you need some help with Maven here.
Alternatively, in ControlsFX, we use Gradle, which is already configured.
Alright that sounds reasonable. I am actually interested in working to get a future more complete and integrated version into ControlsFX so perhaps going with Gradle would be better. Would that satisfy this pull request owner's needs?
Either Maven or Gradle will do, but PR sender did the work configuring project with Maven
Alright i understand I've pulled locally and it seems fine the layout is similar to Gradle's, while I have used neither Gradle nor Maven I've been reading up on both. It's failing to import in Eclipse right now. If I can fix the Eclipse project and get it working I'll push it into master with the fixed Eclipse project.
Re-import as Maven project, which will auto-modify your Eclipse configuration
@eugener Alright that is one step closer, will I need to update the import statements? It's failing to build right now because he did not update the import statements or I am unsure if I've simply imported the project wrong.
Maven is just a build tool. Change your code as much as you need.
I didn't update the eclipse project files. I didn't want to break those further.
It is ok ruckc, I am willing to go with this just please excuse me for not having used Java CL tools before. It is building after updating the package name in all the sources however I am getting an exception.
Image dockImage = new Image(DockFX.class.getResource("docknode.png").toExternalForm());
This in the demo.DockFX where I load the test graphic. This is erroring because it's in a resources package separate from this class. What is the appropriate way to load this file now?
The way Maven plugin in Eclipse works is it keeps your Eclipse project configuration in sync with your Maven one. This makes a lot of sense and allows you to work in Eclipse using maven project. Usually IDE specific files are not committed into source repositories. To ease you pain of testing, just create a new branch and modify everything there until it works. You can later merge it into master
I moved the graphics and css into src/main/resources. Maven/Gradle convention has them in separate paths, but merged in the final jar.
Yes.. should work exactly the same way because it is brought into the same location during the build
Hrm, I must be missing something in the pom.xml I see
@eugener @ruckc I got everything working, the jar description's are still broke but as long as I can run this from Eclipse everything is fine. Thank you!
There is no need for jardesc files anymore - your pom.xml
describes everything. Simple mvn package
command will make a jar
Oh excellent that was as I had assumed. I've configured the environment variables and Maven seems to be working. After that command I have the following:
EclipseWorkspace\DockFX\target\dockfx-1.0-SNAPSHOT.jar
However I believe this is configured to build the library? I'm not sure where the demo has outputted to and am unable to find it.
I really appreciate your guidance.
I'm sure it is part of your jar. You can run it by specifying the main class.
Also you don't need to install maven. It is part of your Eclipse already. Just use Run as
context menu on your project
@eugener Alright from the following link I think I know how to get it. Is it reasonable to use a separate pom.xml file for my demo? Such as pom-demo.xml? I am not looking to specify a main class for the library. http://www.avajava.com/tutorials/lessons/how-do-i-specify-a-main-class-in-the-manifest-of-my-generated-jar-file.html
Not really. Just describe the main class + manifest in your pom.xml
. This will make your jar runnable and it will run your demo by default. At the same time It could be used as a library.
Check out this link http://www.vogella.com/tutorials/EclipseMaven/article.html It is a good starting point on Eclipse+Maven
Great that link fixed everything! For now I guess we'll just always use the demo as the main class, so I made the demo run without the presence of the readme.html which is optional.
Later it can be configured through a profile to set the main class and copy the readme.html to the target/ folder. http://www.jpeterson.com/2009/08/25/using-a-maven-profile-to-run-a-test-program/
Thank you for all of your help!
I'm not an Eclipse user, so I rearrange the project for Maven. I also incorporated the Google Java checkstyle guidelines.