-
Notifications
You must be signed in to change notification settings - Fork 7
Add a Maven Build #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Add a Maven build so the project can be build from the command line without having to use an IDE. In addition this commit contains the following changes: - follow Maven source layout conventions - add a module-info - add a .gitignore file that contains the Maven output folder
|
Hi Philippe, thanks a lot for you pull request! I'm not working with Maven a lot and I don't really know much about it so I very welcome your contribution. On the command line, I could successfully use Maven to build the project with your pom file. However in Eclipse with the m2e plugin I see some problems during the generation of the Javadoc. If the default JDK in Eclipse is set to jdk9, the javadoc tool ca not be found at all: If the default JDK in Eclipse is set to jdk8, Maven seems to pick up the javadoc from jdk8 (although it correctly uses javac from jdk 9 to compile java files) which results in the following error: I've tried to use the Is there any way to make the javadoc Maven plugin choose toe corect javadoc version (much the same as it chooses the correct javac version)? I'm using Eclipse Oxygen.2 Release (4.7.2) with m2e 1.8.2.20171007-0217. |
|
How are you trying to generate Javadocs in Eclispe, when are you getting the error? |
|
I see the reported problems when I use “Run as”->m2e->install (or package) from the project context menu. How else would build the project from within Eclipse using Maven? Maybe the easiest solution would be to completely remove the javadoc step from the Maven file. The project is for a command line utility so I don’t expect it will ever contain a substantial API. Also, would it make sense to add a default target to the pom file? I don’t know what's common in the Maven world. |
|
There isn't really a need to explicitly run Maven in Eclipse with m2e. m2e will set up everything including class path containers so that the normal Eclipse incremental build uses Maven. Simply save your files and you're done. You just have to make sure your project has the maven2 nature and builder. You can verify your project has the maven2 nature and builder when it has a blue "M" decorator on the top left (or looking in the .project file if this is your thing). Usually the maven2 nature and builder get added using one of these two ways: Configure → Convert to Maven Project Maven offers predefined phases which are similar to goals. A complete list can be found at Lifecycle Reference. The most important ones are
To be clear, I believe the project should have an automated build (the ability to build on the command line without having to use a specific IDE or directly invoking javac). I don't particularly care what is used (Make, Ant, Gradle, Maven, Shell Script, …). I'm most familiar with Maven so I used Maven. I'm happy to answer any Maven related questions, including beginner ones. |
|
I fully agree that the project should have an automated build and I'm really thankful that you've created one! I'm just trying to understand how this is working which shouldn't be any criticism on your submitted code but just proof of my ignorance :) Now when I import the Maven project into Eclipse (exactly as you described) only the "compile" target seems to be called by default, because I get the following: I thought it would be nice to generate the jar file as well, so I called "Project->Run As->Maven build... " and entered "packages" as goal. This gave me the problems I've described in my first mail. If that's the normal behaviour that the Maven plugin in Eclipse can only be used to compile a Maven project but not to execute any other goals, that's a little disappointing, but I can live with that. I just wanted to ask if that's the expected behaviour or if there's another way of executing the various Maven goals from within Eclipse. If you think this is a problem of the Eclipse Maven plugin, that's OK either. Thanks, |
To the best of my knowledge Maven does not have a default phase. I have never seen a project define one and don't even know if that's possible.
That looks like a bug in m2e. First I thought that the issue was that under the "JRE" tab it defaults to "Workspace default JRE" rather than an "Execution Environment". But setting this to "JavaSE-9" did not fix the issue. Only defining |
Thank you for your work. I found the project a bit difficult to use because it contains no build script so I created one for Maven.
Building in Eclipse requires M2Eclipse http://www.eclipse.org/m2e/
Building outside of Eclipse requires Apache Maven https://maven.apache.org/install.html
An argument can be made that the package name should be
io.simonis.cl4cdsinstead ofio.simonisbut I left this unchanged.