Unable to 'Maven Build' my Java Project in Eclipse IDE - java

I have a working Java Project (literally just 2 JAVA files) that need to be built in either Maven or Gradle. Since I wrote my Java Project in Eclipse IDE for Java Delopers (Kepler Service Release 2, 20140224-0627), I found this article to add Maven to my Java Project.
After adding Maven to my project, I had to follow this SO answer to allow myself to Right Click the Project -> Maven -> Update Project... properly. If I Right Click the Project -> Run As -> Maven Clean, I get a BUILD SUCCESS (thanks to this SO answer). But now when I Right Click the Project -> Run As -> Maven Install, I get the following:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AMC 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # RobTillmanProject ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Users\names\workspace\paging-mission-control\AMC\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # RobTillmanProject ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 2 source files to D:\Users\names\workspace\paging-mission-control\AMC\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.050s
[INFO] Finished at: Tue Feb 07 16:35:15 EST 2023
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project RobTillmanProject: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
As per the error, it looks like I need to add a JDK to the Installed JREs list (just as this SO answer suggests).
In Eclipse IDE, Windows -> Preferences -> Java -> Installed JREs, I have jre1.8.0_333 (default) installed. On my PC, in my C:\Program Files\Java folder, I've installed jdk-17, jdk-17.0.6 and jdk-19.0.2. However, when I go to add any one of the JDKs (I've tried JRE Type Standard 1.1x VM and Standard VM), I get the error message Target is not a JDK root. System library was not found.
I'm running Eclipse IDE on Windows 10.
Any suggestions?

Make sure you are adding the correct location for the JDK home in the "Installed JREs" section.
For instance, I am using JDK 8 and selecting the JDK as the default as below:
Make sure you are also changing the compiler version to use the one matching your JDK. Other side, like your are using maven clean install to build your project, then make sure the maven distribution is using the correct JAVA_HOME.
In Eclipse, go to again Window / Preferences / Maven / Installations
Select your local maven distribution instead of using the embed version with Eclipse, for instance:
You can check if your maven distribution is using the correct JDK by typing in a cmd : mvn -version, for example in my Windows I am using JDK 11 like you can see in the below output:
Hope this can help. Please let me know.

Related

Maven writes \u0000 into resolver-status.properties files, failing subsequent builds

I am using MacOS and I am using Maven in version 3.8.7. I am using Java in 11.0.17 by Eclipse Temurin.
Somehow, when building a big Maven project, Maven creates resolver-status.properties files that contain invalid characters:
.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:3:\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:4:maven-metadata-willhaben-ne\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:8:maven-metadata-shibboleth-\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
A subsequent Maven build is then failing with this error message:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.281 s
[INFO] Finished at: 2023-01-17T09:19:29+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Malformed \uxxxx encoding.
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
The error is happening when I run Maven both with one thread and with multiple threads.
How can I fix my build so that Maven no longer writes \u0000 in resolver-status.properties files?
I know suspect that the broken files get downloaded from Nexus when performing the Maven build anew.
On our CI they are built with a somewhat older Maven version and with multiple threads.

Why is my java build failing using Maven?

I'm getting this error when trying to compile a java project.
[INFO] Failed to parse a schema.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:46 min
[INFO] Finished at: 2020-10-10T11:37:54+10:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc (demo) on project demo-server: Could not process schema files in directory C:\Users\jake\Desktop\Demos\ec\server\src\main\xsd\demo -> [Help 1]
[ERROR]
I'm not too sure what's going wrong here, or how to fix it in order to make it successfully build.
The error messages are from the "xjc" task of "jaxb2-maven-plugin". It is trying to generate Java source code from XSD files in the "src\main\xsd\demo" directory.
Apparently, there is a syntax problem in one or more of the XSD files.
To get more information about those syntax problems, try running Maven in debug mode; e.g. include the -X option on the mvn command line.

mvn appfuse:full-source not working because of subversion

I am new for maven. I have appfuse maven project and it is embedded. I wanted to make it as full-source, but it gave me following error:
Failed to execute goal org.appfuse.plugins:appfuse-maven-plugin:3.0.0:full-source (default-cli) on project OOS: svn: PROPFIND request failed on '/svn/appfuse~svn/tags/APPFUSE_3.0.0/data/common/src'
I have searched solution for this and found this information and applied that solution given in the site: adding
<trunk>https://svn.java.net/svn/appfuse~svn/</trunk>
inside of appfuse configuration tag. After adding this line to my pom.xml file, i have tried to run mvn appfuse:full-source, but it gave me the same error.
full stack is here:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.mycompany:OOS:war:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.exclusions.exclusion.artifactId' for org.springmodules:spring-modules-validation:jar with value '*' does not match a valid id pattern. # line 363, column 33
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AppFuse Spring MVC Application 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- appfuse-maven-plugin:3.0.0:full-source (default-cli) # OOS ---
[INFO] [AppFuse] Installing source from data-common module...
[ERROR] 175002 : svn: PROPFIND request failed on '/svn/appfuse~svn/tags/APPFUSE_3.0.0/data/common/src'
[ERROR] 175002 : svn: svn.java.net: Name or service not known
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.743s
[INFO] Finished at: Fri Oct 10 15:53:55 UZT 2014
[INFO] Final Memory: 10M/144M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.appfuse.plugins:appfuse-maven-plugin:3.0.0:full-source (default-cli) on project OOS: svn: PROPFIND request failed on '/svn/appfuse~svn/tags/APPFUSE_3.0.0/data/common/src'
[ERROR] svn: svn.java.net: Name or service not known
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I have deleted whole repository directory in my .m2 folder, but did not help.
I wanted to check the link https://svn.java.net/svn/appfuse~svn/ but it asked username/password for entering. I think, this also can be a cause. I am using Ubuntu and tried to install subversion form Software center, but was no use: still the same problem.
I hope someone have faced this type of issue and will share.
Finally, I have figured it out. The problem was with mysql db. I was using default configurations in my project's pom.xml and by default it uses mysql dbms. It has connected with db and created all tables in mysql, but hasn't started the project. but, when i have changed db profile to postgresql, it has worked like a charm. I haven't understand why, but the appfuse maven project has some conflicts with mysql dbms.

jenkins Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli)

[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **/pom.xml.backup, **/release.properties, **/pom.xml.branch, **/pom.xml.next, **/pom.xml.releaseBackup, **/pom.xml.tag
[INFO] Executing: /bin/sh -c cd /opt/Jenkins/ic/jenkins/jobs/util/workspace && git status
[INFO] Working directory: /opt/Jenkins/ic/jenkins/jobs/util/workspace
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'my_proyect'...
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:23.375s
[INFO] Finished at: Wed Jan 22 15:21:16 ECT 2014
[JENKINS] Archiving /opt/Jenkins/ic/jenkins/jobs/util/workspace/pom.xml to xx.xxx.xxxx/my_proyect/1.0.2-SNAPSHOT/my_proyect-1.0.2-SNAPSHOT.pom
[INFO] Final Memory: 16M/246M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project my_proyect: Could not create temporary file for release settings.xml: Permission denied -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
channel stopped
Finished: FAILURE
I need help.
When built a snapshot does not give me problems, but if I want to generate a release I get the above log.
I have the jenkins 1.548
maven 3.1.1
nexus 2.7.0-0
Jenkins + maven-release-plugin + settings.xml = painful
Check the following locations for any mention or overrides of settings.xml file:
Jenkins
instance-level config
general Maven section
Maven release plugin section
job-level config
general Maven section
Maven release plugin section
pom.xml file
maven-release-plugin section
profiles section
In addition, things can get fussy depending on how you're running the job in Jenkins:
freestyle job with Maven goals
Maven job using regular "Build" button with "release:prepare" goals
Maven build using "Run Maven Release" button
Try experimenting with different job types.

Maven error while setting up i.lon 100 server in eclipse

I'm trying to connect i.lon100 with JAVA using Programmers Reference. pom.xml and .pdf file with Programmer reference can be downloaded from page: http://home.elka.pw.edu.pl/~mkolasin/
My eclipse version is:
Eclipse Java EE IDE for Web Developers.
Version: Juno Service Release 2
Build id: 20130225-0426
Maven version: 2.2.1 (as recomended in programmers reference)
a) First of all I have a problem with page 22-6 with installing Maven Embedder and Maven Integration for Eclipse, becouse I assume that http://m2eclipse.sonatype.org/update/ page doesn't exsist. So, my first question: is there any other site I can download those software using eclipse?
B) I installed from eclipse market: Maven integration for eclipse, but i couldn't find Maven Embedder. And now i have got right click on project: RUN AS - Maven Built instead of Run AS - maven package is it still okay?
c) When i try to make another step page 22-13 "In the Project Explorer view, right-click the ilon-ws folder, point to Run As, and then click
Maven Package. This generates the java proxy classes and builds the jar." i got an error in console and i don't know how to fix it.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org...ticLoggerBinder for further details.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.echelon.es:ilon-ws:jar:4.03-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:jaxws-maven-plugin is missing. # line 71, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 113, column 23
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. # line 124, column 23
[WARNING] 'repositories.repository.layout' for java.net uses the unsupported value 'legacy', artifact resolution might fail. # line 36, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ECHELON i.LON SmartServer 4.03-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.985s
[INFO] Finished at: Tue Jun 04 20:20:25 CEST 2013
[INFO] Final Memory: 4M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ilon-ws: Could not resolve dependencies for project com.echelon.es:ilon-ws:jar:4.03-SNAPSHOT: Failed to collect dependencies for [com.sun.xml.ws:jaxws-rt:jar:2.2 (compile)]: Failed to read artifact descriptor for woodstox:wstx-asl:jar:3.2.1: Could not transfer artifact woodstox:wstx-asl:pom:3.2.1 from/to java.net (http://download.java.net/maven/1/): No connector available to access repository java.net (http://download.java.net/maven/1/) of type legacy using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache....lutionException
I tried adding slf4j-nop-1.7.5.jar file to buildpath and nothing has changed.
Please give me any suggestions or help, becouse I can't handle it since last few days, and i don't know where to find answers.
Regards,
Kolata

Categories