Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

maven failed with -endorseddirs

 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi running with maven 3.5.2, jdk 1.7 in freebsd 10.
compiling on a ear project with dependencies ejb and war.
It failed with the following errors:

-sourcepath /home/sam/imac-files/work/NetBeansProjects/Client/ForestsurfClient/ForestsurfClient-web/src/main/java:/home/sam/imac-files/work/NetBeansProjects/Client/ForestsurfClient/ForestsurfClient-web/target/generated-sources/annotations: -s /home/sam/imac-files/work/NetBeansProjects/Client/ForestsurfClient/ForestsurfClient-web/target/generated-sources/annotations -g -nowarn -target 1.7 -source 1.7 -endorseddirs
[WARNING] File encoding has not been set, using platform encoding US-ASCII, i.e. build is platform dependent!
[DEBUG] incrementalBuildHelper#beforeRebuildExecution
[INFO] Compiling 93 source files to /home/sam/imac-files/work/NetBeansProjects/Client/ForestsurfClient/ForestsurfClient-web/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.151 s
[INFO] Finished at: 2015-03-09T11:51:32+11:00
[INFO] Final Memory: 19M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project ForestsurfClient-web: Fatal error compiling: -endorseddirs -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project ForestsurfClient-web: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:834)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.codehaus.plexus.compiler.CompilerException: -endorseddirs
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:172)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:823)
... 22 more
Caused by: java.lang.IllegalArgumentException: -endorseddirs
at com.sun.tools.javac.util.BaseFileManager.handleOption(BaseFileManager.java:148)
at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:227)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:199)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:123)
... 24 more
[ERROR]
[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
[sam@DellWS ~/imac-files/work/NetBeansProjects/Client/ForestsurfClient/ForestsurfClient-web]$



Any help is very much appreciated.
Thanks
Sam
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried to specify the maven-compiler-plugin in your pom? Can you post it here?
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:Have you tried to specify the maven-compiler-plugin in your pom? Can you post it here?



Here is the pom.xml in my war module:

 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Where have you set the endorsed.dir property? Is it specified in your settings.xml? As far as I know, it's not an inbuilt property. You can run mvn help:effective-pom, it will print out the pom with the property replaced with the value. Can you check if enorder.dir is being replaced with the folder you want the endorsed dir to point to

2) WHy are you doing it this way? You are using maven-dependency-plugin to download it to endorsed-dir, and then specifiying it in endorsed dirs during compilation. WHy don't you just add the jar into the list of dependencies?
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:1) Where have you set the endorsed.dir property? Is it specified in your settings.xml? As far as I know, it's not an inbuilt property. You can run mvn help:effective-pom, it will print out the pom with the property replaced with the value. Can you check if enorder.dir is being replaced with the folder you want the endorsed dir to point to

2) WHy are you doing it this way? You are using maven-dependency-plugin to download it to endorsed-dir, and then specifiying it in endorsed dirs during compilation. WHy don't you just add the jar into the list of dependencies?



Oops, the "endors dir " is not being replaced when I execute thehelp command:

<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>



The ejb module is part of the ear project, and the war module is depend on the ejb module, therefore the ejb module is supposed written to the .m2/repository directory.
It was working fine in the old machine, but when I changed to the new system, it generated this error.

Thanks
sam
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You had endorsed.dir set in the old machine.


Which leads to my second question. Why are you doing things this way. If you are doing is because you want that jar for compilation and not during runtime, you can look at the scope element of the dependency tag
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:You had endorsed.dir set in the old machine.


Which leads to my second question. Why are you doing things this way. If you are doing is because you want that jar for compilation and not during runtime, you can look at the scope element of the dependency tag



I used dependancy tag with provided scope in the pom.xml of my ejb module.
The jar file is written to the .m2/repository, but the war module could not find it.
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean couldn't find it? Couldn't find it during compilation? Packaging? Deploy? Run?
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:What do you mean couldn't find it? Couldn't find it during compilation? Packaging? Deploy? Run?



The war moudle coulding find the ejb jar file in .m2/repository/xyz-ejb/1.0/ folder.
How to define it in settings.xml file so that all my modules in different project find its dependant ejb modules in the .m2/repository/.... ?

Very appreciate for your help.
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

sam White wrote:

Jayesh A Lalwani wrote:What do you mean couldn't find it? Couldn't find it during compilation? Packaging? Deploy? Run?



The war moudle coulding find the ejb jar file in .m2/repository/xyz-ejb/1.0/ folder.
How to define it in settings.xml file so that all my modules in different project find its dependant ejb modules in the .m2/repository/.... ?

Very appreciate for your help.



Should I confiure ejb module to save its jar file to .m2/repository folder or configure the war module to read from the target/ folder in ejb module rather than referring to the .m2 / repository ?
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

sam White wrote:

sam White wrote:

Jayesh A Lalwani wrote:What do you mean couldn't find it? Couldn't find it during compilation? Packaging? Deploy? Run?



The war moudle coulding find the ejb jar file in .m2/repository/xyz-ejb/1.0/ folder.
How to define it in settings.xml file so that all my modules in different project find its dependant ejb modules in the .m2/repository/.... ?

Very appreciate for your help.



Should I confiure ejb module to save its jar file to .m2/repository folder or configure the war module to read from the target/ folder in ejb module rather than referring to the .m2 / repository ?



I am wondering whether there is any samples to cnofigure sesttings or pom.xml to deal with specific ejb jar file into local .m2 repository directory and then read from there from the war module pom.xml?
 
    Bookmark Topic Watch Topic
  • New Topic