Maven site fails while building javadoc - java

I try to build a site for my minecraft plugin but it fails during javadoc generation. I have my pom.xml and the log in this gist.
When I run mvn clean site it fails while generating javadoc because it does not find the dependencies used in my program. The problem is, that these dependencies are usually provided by the server, which tries to run the plugin so it does not make any sense to compile these dependencies. For some dependencies it is even forbidden to compile them. For example the spigot-api, which is part of the io.papermc.paper:paper-api-dependency.
And the weird thing is, it works just fine in IntelliJ. When I run the mvn clean site-command in IntelliJ using a run configuration it works just fine.
I already tried the additionalDependencies option but it did not improve the result.
I could stop it from failing the build by setting failOnError and failOnWarning to false but I still don't want these errors in my log.
Any ideas how to fix it?
Sincerely yours,
Trqhxrd

Related

Maven can't find a module

I've been trying for the last few weeks at this point to get Maven to compile my project and I am so desperate
I am running the following maven command on the root directory:
mvn clean verify -fae -X
And I am getting the following output: log on Pastebin
This clearly means that it cannot find the module that it has already identified, during compile (meaning any goal that includes compile will throw the same error). IntelliJ could even find the source of the module (with find usages) in the MAVEN LOCAL REPO as a compiled JAR, which baffles me because maven doesn't seem to want to figure that one out and now after renaming it can find the sources in this project too, so I don't know where it could be going wrong at all.
I can't provide any relevant code, because I have no clue where the issue might lie. All of my code can be found on my GitHub here, in the IerisLib repository on the experimental branch.
I am extremely frustrated with this issue and at this point I don't know what to do. I have attempted:
Deleting all and cloning again, changing the module's names twice, rewriting the module-info.java files and just playing around with Maven command parameters(that's how I came up with -fae -X instead of just mvn clean verify).
I'm running Maven 3.8.5
Please, any help is appreciated

IntelliJ does not recompile/build maven project

I am running into problems when using IntelliJ for Spring development. At first, the IntelliJ build command works fine and picks up changes I make to the source code. At some point, this stops working and I can only compile my sources through maven, as the build or rebuild project commands seem to do nothing anymore.
I am confused, as it works as desired at the start but then stops working at some point.
Steps to recreate:
Create a new Spring project using Spring Initializr:
curl https://start.spring.io/starter.zip -d type=maven-project -d javaVersion=11 -o demo.zip && unzip demo.zip
Start IntelliJ from the command line in that folder, this will auto-import the project: idea64 .
Write a log message in the main class and run the project using Run->Run 'DemoApplication'. This compiles the sources to the target folder and starts up the project. You should see the log message
Alter the log message, run again and the changes should be visible (so far so good)
Now re-compile the sources via maven command mvn compile and restart IntelliJ
From now on, running build or rebuild project within IntelliJ will not pick up any changes I make to any of my source files. In fact both commands don't seem to do anything at all. I have to compile via maven in order to properly compile my sources
I tried a few things to overcome this problem, but without success:
Invalidated caches/restart
Checked project settings for Project Compiler Output and set it to <project-folder>/target
Checked project settings/modules for output path and test output path and put in the path as above
Used Reimport All Maven Projects
Deleted the .idea folder within the project folder. This seems to work, but is very inconvenient and surely no intended behavior. Also it breaks again if I recreate the steps detailed above.
Is anyone experiencing similar problems and/or has a solution?
So for anyone running into the problems I described above:
Apparently deleting the .idea folder and restarting IntelliJ does indeed do the trick. The folder is recreated on restart and afterwards I'm able to switch between compiling within IntelliJ using run, build or rebuild project and compiling through maven goals (mvn compile, mvn test, mvn surefire:test, ...). This persists through restarts of IntelliJ such that I don't have to repeat this everytime I open a project.
I still don't know why this behavior happens, but it's a solution I'm happy to work with as long as I only have to do it every now and then for a project.
Sounds like do don't want Intellij's default build. You want Intellij to forward the build command to mvn. I assume this because you do not mention this step in your question.
Here's a screenshot that shows how to enable it:
More detail is available in the Intellij documentation https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html#delegate_run_action

Issue to start a simple maven project in eclipse?

I have to work with Eclipse due to some reasons which is fresh to me.I created a simple dynamic web project using Maven,then I try to run this project with plugin called tomcat7-maven-plugin,but each time I run it with command tomcat7:run,the console shows build success but the project is automatically terminated.This really confused me,because when I deploy it on my
local tomcat, nothing happened.
from the snippet, I guess the reason is that it tells:
Skipping non-war project
This basically means that your maven project does not produce a WAR (packaging=war) hence tomcat plugin has nothing to run.
I think also that it's not really related to Eclipse here (try to run it from the command line and the results will be the same)
Please restart the eclipse and clean the project. hopefully it will work.

Hinderance when attempting to add MySQL connector through Maven

When I use mvn clean install after adding the dependency in the 'pom.xml', I get the following output, instead of the expected Downloading: https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/6.0.5/mysql-connector-java-6.0.5.pom-type of message.
You've only posted the end of the Maven output -- are you sure the new dependency wasn't downloaded before the tests were run? It finishes with BUILD SUCCESS... how do you know something's not working?
What changes did you make to the pom.xml file? If I could see those, I could offer some thoughts about whether they look correct or not.
In case there's any confusion on this point -- you indicate that you ran mvn clean install. These are lifecycle goals of the project itself. Some of what you posted makes me wonder if you really intended to run (thought you were running) the maven-install-plugin. That would look more like $mvn install:install ....

Maven rebuild failure of tests, build does not complete

I have a large project that I am working on. I recently checked out our evolution branch, did a git pull and tried to deploy the app locally. It doesn't seem to recognize some libraries or jars in one Java class, so subsequently errors halt me from running. Basically, the import statements go unrecognized in the class.
Turns out I forgot to rebuild maven. When I ran mvn clean install from the command prompt, the build fails (even when I do mvn clean install -fn) as there are tests that fail. I don't often work with maven, or the command line, but here is my full stack trace when I run mvn clean install -e:
I'm running my project in the IntelliJ environment.
When I ran mvn clean install -fn, 'talent-app' was successful, but talent-core still failed and I still got
[INFO] BUILD FAILURE
Please let me know if you have any input, I appreciate it!
I'm not sure I understand your question correctly.
Basically, regarding your first paragraph, you said you had library issues but that after a clean rebuild - of your project, I suppose not of Maven itself - everything is fine?
Regarding the rest of your post, your build is failing because of a failing test case. This is shown by the line:
talent-core ............................... FAILURE
and by the output:
Failed to execute goal [...]. There are test failures.
If you go into the target/surefire-reports folder, you will find some files containing the output and error traces of each test, including the one that failed.
By scrolling up in your terminal, you should also be able to see which test was failing for talent-core.
From then on, by order of preference:
either look at the test reports as mentioned in the output, and attempt to figure our why the test is failing, and either fix the test or the code;
or skip the tests, you can add -DskipTests to the command-line. But you shouldn't skip your tests, really.

Categories

Resources