Maven eclipse packaging "pom" not working - java

I'm using Eclipse Mars (4.5) with Maven 3.3.3.
Recently, I did a Maven update on a project Java 8 (SE), and all of the sudden, Eclipse didn't want the <packaging>jar</packaging> in my pom.xml to be valid, but wanted me to change the packaging to pom. Why can't I leave it to jar ?
Moreover, in the overview, the packaging choice is disabled.
When running maven from console (with jar packaging), this is what I get:
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Child module C:\Users\Me\workspace\MyProject\? of C:\Users\Me\workspace\MyProject\pom.xml does not exist #
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. # line 8, column 13
#
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Child module C:\Users\Me\workspace\MyProject\? of C:\Users\Me\workspace\MyProject\pom.xml does not exist #
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. # line 8, column 13
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:422)
at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
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)
[ERROR]
[ERROR] The project MyProject:model:0.2 (C:\Users\Me\workspace\MyProject\pom.xml) has 2 errors
[ERROR] Child module C:\Users\Me\workspace\MyProject\? of C:\Users\Me\workspace\MyProject\pom.xml does not exist
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. # line 8, column 13
Can somebody help me ? at least in re-enabling jar packaging.
Thanks.
EDIT: Indeed, somehow my pom.xml had some new lines added (I don't know why or how):
<modules>
<module>?</module>
</modules>
That was what caused the issue. Removing it made the problem go away, thank you !

Because if your pom declares modules it is an "aggregator POM" - aggregator modules must be pom. That is why you get the following error in your log:
[ERROR] 'packaging' with value 'jar' is invalid.
Aggregator projects require 'pom' as packaging. # line 8, column 13
You can go back to jar when you remove all the <module> declarations from your pom.
Please refer to the documentation of multi-module projects.

Somehow after restarting Eclipse an additional "module" with a "?" got added to my pom file. Search for this and remove it. It will resolve the issue.
<module>?</module>

Related

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project produit-webapp

I have a webapp that I try to compile using maven, unfortunatly it is not working when doing mvn clean package. There is a LOT of questions on stackoverflow that seems the same but none solved my issue.
I doubled checked if version of Java is the same (set to 1.7) for JAVA_HOME + target and source of Maven compile plugin. It is.
I tried upgrading and downgrading maven compile plugin without success.
Unfortunatly, it is not possible to put my pom.xml here as it is +1500 lines long.
This error occured after I added a new maven module (that has firebase as a dependency) to my produit-webapp. This module compiled fine.
The error output I get from running it with the full debug logging:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project produit-webapp: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project produit-webapp: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:862)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
You might want to look into the dependencies of your webapp (in pom.xml). You stated that your pom.xml is very long, I'm guessing it was working before with other modules and you added a new module.
If so, you should try remove the dependency to the new module. If it's compiling fine then, at least, you know where it comes from.
To do further investigation, add back the new module in your webapp and then remove dependencies inside the new module. Add back one by one the dependencies to find the one that is causing the problem.
Once you found the culprit dependency, see what are the dependencies of this dependency (ctrl + left click on the dependency in Eclipse to open the related pom.xml) and do the same as previously : remove dependencies and add them back to find what is causing the problem.
How to properly remove dependencies :
You should use the <exclusion> tag and not just comment out dependency, see this page on how to do so.
If you have a lot of dependencies, it can be long do exclude module one by one, so you can do it faster by removing half of it and see if it's compiling. If it's not compiling then it means the culprit dependency is inside the other half. Try with the other half which should compile. Repeat with half of this part until you find the responsible (kinda like in a binary search)
This solution is recommend only to find where the issue comes from. It removes the error when compiling but your webapp mights throw an error on runtime as it needs the dependency you removed !

SonarQube 6.0 analysis fails on module without code

ENVIRONMENT
Jenkins 2.23
SonarQube plugin 2.4.4
SonarQube 6.0
Java plugin 4.2
Findbugs plugin 3.4.3
Clirr 1.3
(some other plugins, probably not relevant for this issue, but feel free to ask in the comments and I´ll edit the question)
I have a multi-module Maven project with one root module (pom packaging, no code) and several child modules (jar packaging, code). I´m running SonarQube analysis in a Maven job in Jenkins.
PROBLEM DESCRIPTION
Analysis worked ok in SQ 5.x. Since upgrading to SQ 6.0, the analysis fails:
the analysis on the child modules succeeds
the analysis on the root module fails with error:
[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on
project root:
org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
-> [Help 1]
ALREADY TRIED
excluding the root module from analysis --> results in Maven error
Unable to determine structure of project. Probably you use Maven
Advanced Reactor Options with a broken tree of modules. "foo" is
orphan
Findbugs plugin 3.4.4 from https://github.com/SonarQubeCommunity/sonar-findbugs/releases (as hinted in API incompatibility with SonarQube 5.6 and Java Analyzer 4.0 with Findbugs 3.3 or Cobertura 1.6.3) --> same error
DEBUG LOGGING
Maven with -e and -X
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project root: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource; -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project root: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:139)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:132)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 31 more
Caused by: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
at org.sonar.plugins.clirr.ClirrSensor.saveIssues(ClirrSensor.java:94)
at org.sonar.plugins.clirr.ClirrSensor.analyse(ClirrSensor.java:76)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:184)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:118)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:78)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:135)
... 34 more
[ERROR]
[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
QUESTION
Is this a configuration issue at my end? Or is there an issue with SonarQube or any of the plugins?
I will also accept answers that let me exclude the codeless root module as a workaround, without any interference for the child modules that have it as a parent.
The lines that might have raised your attention are the following ones:
Caused by: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
at org.sonar.plugins.clirr.ClirrSensor.saveIssues(ClirrSensor.java:94)
You must uninstall the Clirr plugin: it is not compatible with SonarQube 6.0.
To be honest, maybe this is not exactly the solution to your problem. But let me describe where I ran into a similar problem that matches your following description:
Unable to determine structure of project. Probably you use Maven Advanced Reactor Options with a broken tree of modules. "foo" is orphan.
I had changed my maven build to ci friendly as described by maven here.
Generally, my maven build was running fine until I added sonarqube check. Then I got the above-described message. It took a while to finde the problem and it was quite tricky.
By the way, I had a multiple module maven project running and the problem was that in my parent pom I was referring to the pom.xml instead of the folder.
<modules>
<module>modules/module1</module>
<!-- the reference to the pom.xml is the problem.
and will cause sonar to fail -->
<module>modules/module2/pom.xml</module>
</modules>

Web script groovy - Alfresco

I'm trying to make a web script in groovy and run that web script on Alfresco. But, i don't know how to. I read tutorials but I haven't come to any conclusion...
Anyone knows all steps to run a web script in groovy ? Which files I need?
My idea is to make a integration of one application groovy on Alfresco.
For example, i'm trying to test one of this web scripts: https://github.com/pmonks/alfresco-groovy-webscripts
But i got the error :
$ mvn clean package
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/alfresco/extension/alfresco-groovy-webscripts-parent/1.3/alfresco-groovy-webscripts-parent-1.3.pom
[INFO] Unable to find resource 'org.alfresco.extension:alfresco-groovy-webscripts-parent:pom:1.3' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: null:alfresco-groovy-webscripts-webscripts:amp:null
Reason: Cannot find parent: org.alfresco.extension:alfresco-groovy-webscripts-parent for project: null:alfresco-groovy-webscripts-webscripts:amp:null for project null:alfresco-groovy-webscripts-webscripts:amp:null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot find parent: org.alfresco.extension:alfresco-groovy-webscripts-parent for project: null:alfresco-groovy-webscripts-webscripts:amp:null for project null:alfresco-groovy-webscripts-webscripts:amp:null
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent: org.alfresco.extension:alfresco-groovy-webscripts-parent for project: null:alfresco-groovy-webscripts-webscripts:amp:null for project null:alfresco-groovy-webscripts-webscripts:amp:null
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1396)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
... 12 more
Caused by: org.apache.maven.project.ProjectBuildingException: POM 'org.alfresco.extension:alfresco-groovy-webscripts-parent' not found in repository: Unable to download the artifact from any repository
org.alfresco.extension:alfresco-groovy-webscripts-parent:pom:1.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project org.alfresco.extension:alfresco-groovy-webscripts-parent
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
... 18 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository
org.alfresco.extension:alfresco-groovy-webscripts-parent:pom:1.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
... 19 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
... 21 more
I try too the web scripts already in Alfresco examples, but i got error, for example:
The Web Script /alfresco/s/default/surfbug has responded with a status of 500 - Internal Error.
This looks like strictly a maven problem to me. The exception states that Unable to download the artifact from any repository. This means that you've got a dependency on something that can't be found in either your local repository or any of the default or configured remote repository.
The missing dependency is stated as org.alfresco.extension:alfresco-groovy-webscripts-parent:pom:1.3. To get this to work, this artifact needs to be in your local repository. I couldn't find any reference to this in the common remote repositories, so it might be something you need to build from source.
The link you provided in your question is for a github project with the following code in its pom.xml file:
<groupId>org.alfresco.extension</groupId>
<artifactId>alfresco-groovy-webscripts-parent</artifactId>
<packaging>pom</packaging>
<version>1.4-SNAPSHOT</version>
Notice that the groupId and artifactId match your missing dependency, but the version is different. If you've installed this sample, using mvn install, then version 1.4-SNAPSHOT of this dependency should already be in your local repository. You could search your pom files for the dependency on alfresco-groovy-webscripts-parent v1.3, and change it to 1.4-SNAPSHOT and try again.

Maven installing 3rd party Jar file

I am using apache maven 3.1.1. I was trying to install a 3rd party Jar file in my local repository using the following command
mvn install:install-file -Dfile=<path-to-file>
However, I am getting an error saying there is no Pom file in the current directory where the maven is ran from. According to Maven install plug-in if the jar file is created using Maven it will have POM xml in it (and in this case the POM is there in the jar file in a sub-dir of META-INF) and you will not need to supply the path to the POM file.
Did I miss something here?
Here is the error.
$ mvn install:install-file -Dfile=JDBM-3.0-alpha2.jar -ex
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.076s
[INFO] Finished at: Fri Nov 29 22:23:58 EST 2013
[INFO] Final Memory: 5M/147M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/ars/Downloads). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/home/ars/Downloads). Please verify you invoked Maven from the correct directory.
atorg.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:89)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
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:601)
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)
[ERROR]
[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/MissingProjectException
I know this question is quite old but this is what works for me:
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=path/to/file
By fully specifying the plugin, you can get around not having a project POM in that directory.

Error finding jpa-ddl-maven-plugin for DDL Generation from JPA Entities

I'm trying to use the jpa-ddl-maven-plugin as described here but I'm getting a the below error using Apache Maven 3.0.3. Any ideas where I've gone wrong?
my pom.xml:
<plugin>
<groupId>it.linksmt.tooling</groupId>
<artifactId>maven-jpa-ddl-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<extensions>true</extensions>
<configuration>
<targetDbPlatform>OraclePlatform</targetDbPlatform>
<persistenceUnitName>test-entity-api</persistenceUnitName>
<persistenceUnitFile>META-INF/persistence.xml</persistenceUnitFile>
</configuration>
</plugin>
settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>it.linksmt.tooling</pluginGroup>
</pluginGroups>
</settings>
Error:
WARNING] The POM for it.linksmt.tooling:maven-jpa-ddl-plugin:jar:1.0.0-SNAPSHOT is missing, no dependency information available
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.test.sample:sample-api:1.0.0-SNAPSHOT (/project/pom.xml) has 1 error
[ERROR] Unresolveable build extension: Plugin it.linksmt.tooling:maven-jpa-ddl-plugin:1.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact it.linksmt.tooling:maven-jpa-ddl-plugin:jar:1.0.0-SNAPSHOT -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
mvn clean install -e output:
ERROR]
[ERROR] The project com.test:sample:sample-api:1.0.0-SNAPSHOT (/project/pom.xml) has 1 error
[ERROR] Unresolveable build extension: Plugin it.linksmt.tooling:maven-jpa-ddl-plugin:1.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact it.linksmt.tooling:maven-jpa-ddl-plugin:jar:1.0.0-SNAPSHOT -> [Help 2]
org.apache.maven.plugin.PluginResolutionException: Plugin it.linksmt.tooling:maven-jpa-ddl-plugin:1.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact it.linksmt.tooling:maven-jpa-ddl-plugin:jar:1.0.0-SNAPSHOT
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:215)
at org.apache.maven.project.DefaultProjectBuildingHelper.resolveExtensionArtifacts(DefaultProjectBuildingHelper.java:377)
at org.apache.maven.project.DefaultProjectBuildingHelper.createProjectRealm(DefaultProjectBuildingHelper.java:237)
at org.apache.maven.project.DefaultModelBuildingListener.buildExtensionsAssembled(DefaultModelBuildingListener.java:106)
at org.apache.maven.model.building.ModelBuildingEventCatapult$1.fire(ModelBuildingEventCatapult.java:43)
at org.apache.maven.model.building.DefaultModelBuilder.fireEvent(DefaultModelBuilder.java:1041)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:391)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:374)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:536)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:542)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:542)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:328)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:632)
at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:581)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:233)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact it.linksmt.tooling:maven-jpa-ddl-plugin:jar:1.0.0-SNAPSHOT
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:541)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:220)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:395)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:207)
... 26 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact it.linksmt.tooling:maven-jpa-ddl-plugin:jar:1.0.0-SNAPSHOT
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:531)
... 29 more
You are trying to use a SNAPSHOT version of the plugin, which will not be found in Maven's default repository - Maven Central.
Looking at the plugin Google code page, it seems that it is currently in beta and has no release version.
You have a couple of options for resolving this plugin:
build it from the source as described here and install it to your local Maven repository. This will be useful only on your machine.
build the plugin and deploy it to a repository manager such as Artifactory. This will help you sharing the plugin with other team members/CI server.
Resolve the plugin from this repository. Notice, I found it by searching Google, but have no idea who is managing it. You will have to define a new repository for this.

Categories