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.
Related
I am getting build error when run with maven. below is the error snippet.
Caused by: java.io.FileNotFoundException: http://repo1.maven.org/maven2/com/day/jcr/vault/maven-vault-plugin/0.0.10/maven-vault-plugin-0.0.10.pom
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
... 30 more
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] Unable to find resource 'com.day.jcr.vault:maven-vault-plugin:pom:0.0.10' in repository central (http://repo1.maven.org/maven2)
[DEBUG] Trying repository adobe-public
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'adobe-public' with url: 'http://repo.adobe.com/nexus/content/groups/public/'.
Downloading: http://repo.adobe.com/nexus/content/groups/public//com/day/jcr/vault/maven-vault-plugin/0.0.10/maven-vault-plugin-0.0.10.pom
[DEBUG] attempting to create parent directories for destination: maven-vault-plugin-0.0.10.pom.tmp
178b downloaded (maven-vault-plugin-0.0.10.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '81ffbd1712afe8cdf138b570c0fc9934742c33c1'; remote = '<html>
<head><title>301' - RETRYING
Downloading: http://repo.adobe.com/nexus/content/groups/public//com/day/jcr/vault/maven-vault-plugin/0.0.10/maven-vault-plugin-0.0.10.pom
[DEBUG] attempting to create parent directories for destination: maven-vault-plugin-0.0.10.pom.tmp
178b downloaded (maven-vault-plugin-0.0.10.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '81ffbd1712afe8cdf138b570c0fc9934742c33c1'; remote = '<html>
<head><title>301' - IGNORING
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Artifact resolved
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.day.jcr.vault:maven-vault-plugin
POM Location: C:\Users\username\.m2\repository\com\day\jcr\vault\maven-vault-plugin\0.0.10\maven-vault-plugin-0.0.10.pom
Reason: Not a v4.0.0 POM. for project com.day.jcr.vault:maven-vault-plugin at C:\Users\username\.m2\repository\com\day\jcr\vault\maven-vault-plugi
n\0.0.10\maven-vault-plugin-0.0.10.pom
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to build project for plugin 'com.day.jcr.vault:maven-vault-plugin': Not a v4.0.0 POM. f
or project com.day.jcr.vault:maven-vault-plugin at C:\Users\username\.m2\repository\com\day\jcr\vault\maven-vault-plugin\0.0.10\maven-vault-plugin
-0.0.10.pom
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.loadPluginFully(DefaultLifecycleExecutor.java:1599)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findArtifactTypeHandlersInPlugins(DefaultLifecycleExecutor.java:1468)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findExtensions(DefaultLifecycleExecutor.java:222)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:178)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
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)
I have added maven repo then adobe repo. Intially build try to find vault plugin through maven repo, which cause error FNF, then tried adobe repo. Vault plugin is present on adobe repo, but its download only POM with 301 message.
Any thoughts.
pom snippet :
<repositories>
<repository>
<id>maven-central</id>
<name>Maven2</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>adobe-public</id>
<name>Adobe</name>
<url>https://repo.adobe.com/nexus/content/groups/public/</url>
</repository>
</repositories>
After changing to https, fall back not happen to adobe. Below is the error :
... 27 more
Caused by: java.io.FileNotFoundException: http://repo1.maven.org/maven2/com/day/jcr/vault/maven-vault-plugin/0.0.10/maven-vault-plugin-0.0.10.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
... 27 more
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] Unable to find resource 'com.day.jcr.vault:maven-vault-plugin:maven-plugin:0.0.10' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository
You request an http URL and get back a 301 redirect to an https URL. Such redirects between schemes is not followed by default, because of security risks. When the POM is requested only the 301 redirect HTML page is retrieved which has 81ffbd1712afe8cdf138b570c0fc9934742c33c1 as SHA1 checksum. Then the POM URL + .sha1 is retrieved which should have the checksum of the POM in its first line and they are compared. Here again you onyl get the 301 redirect page, so 81ffbd1712afe8cdf138b570c0fc9934742c33c1 is compared against '<html>\n<head><title>301' which of course does not match.
Configure the https URL instead for the Adobe repo directly and it should work just fine.
I've been receiving an error while trying to release a new version of software to Sonatype. I've successfully completed mvn release:prepare but when I do mvn release:perform I get the following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:52.660s
[INFO] Finished at: Fri Feb 14 22:32:52 EST 2014
[INFO] Final Memory: 28M/263M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project flexjson: Failed to deploy artifacts: Could not transfer artifact net.sf.flexjson:flexjson:jar:3.2 from/to sonatype-nexus-staging (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Failed to transfer file: https://oss.sonatype.org/service/local/staging/deploy/maven2/net/sf/flexjson/flexjson/3.2/flexjson-3.2.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [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
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:00.122s
[INFO] Finished at: Fri Feb 14 22:32:52 EST 2014
[INFO] Final Memory: 14M/184M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:perform (default-cli) on project flexjson: Maven execution failed, exit code: '1' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:perform (default-cli) on project flexjson: Maven execution failed, exit code: '1'
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
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: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: Maven execution failed, exit code: '1'
at org.apache.maven.plugins.release.PerformReleaseMojo.execute(PerformReleaseMojo.java:135)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: Maven execution failed, exit code: '1'
at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute(AbstractRunGoalsPhase.java:90)
at org.apache.maven.shared.release.phase.RunPerformGoalsPhase.execute(RunPerformGoalsPhase.java:67)
at org.apache.maven.shared.release.DefaultReleaseManager.perform(DefaultReleaseManager.java:343)
at org.apache.maven.shared.release.DefaultReleaseManager.perform(DefaultReleaseManager.java:289)
at org.apache.maven.shared.release.DefaultReleaseManager.perform(DefaultReleaseManager.java:269)
at org.apache.maven.plugins.release.PerformReleaseMojo.execute(PerformReleaseMojo.java:131)
... 21 more
Caused by: org.apache.maven.shared.release.exec.MavenExecutorException: Maven execution failed, exit code: '1'
at org.apache.maven.shared.release.exec.ForkedMavenExecutor.executeGoals(ForkedMavenExecutor.java:122)
at org.apache.maven.shared.release.exec.AbstractMavenExecutor.executeGoals(AbstractMavenExecutor.java:47)
at org.apache.maven.shared.release.exec.ForkedMavenExecutor.executeGoals(ForkedMavenExecutor.java:144)
at org.apache.maven.shared.release.phase.AbstractRunGoalsPhase.execute(AbstractRunGoalsPhase.java:82)
... 26 more
I found blog post about the error, but I don't see anything that matches my setup.
http://blog.sonatype.com/2010/11/what-to-do-when-nexus-returns-401/#.Uv7EYEKwJUI
The post refers to the settings file not matching what's configured in the pom. But I don't have anything in the pom about deployment. I don't have a plugin configured so it must've been using the default plugin configuration for doing releases. As I understand it that's the maven release plugin.
This setup has worked in the past, but I'm doing this from another machine. I had to generate a new gpg private key following this post:
http://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/#.Uv2JUkKwJUI
This setup has worked before, but I've moved to the new machine. I made sure to copy the .m2/settings.xml file to my ~/.m2/settings.xml. Of course that private key is different than the one I had on my old machine. But I can't figure out why that matters or if that matters. From what I've read it's just for code signing. Not sure how that authorizes code signings.
So what am I missing? Why does this 401 error keep happening?
Follow the advice in the first link. 401 means a failure to authenticate against the server. You state that you have nothing configured in your POM to support deployment. If this has previously worked, that cannot be correct. Is there a distribution management section in your POM?
<distributionManagement>
<repository>
<id>nexus-release</id>
<name>My Nexus release area</name>
<url>https://????????</url>
</repository>
</distributionManagement>
The id section must match the id of the "servers" section in your Maven settings file.
<server>
<id>nexus-release</id>
<username>mark</username>
<password>mycleartextpasswordconsiderusingmavenbuiltinencryption</password>
</server>
This is the "gotcha" and illustrates how Maven links the target repo with the user authentication credentials.
Finally to make your my build uses the correct settings file I always pass it as a parameter to by build:
mvn -s ~/.m2/settings.xml ....
This approach also enables different settings files for different projects.
Note
The second link is unrelated. It deals with signing the artifact you
are publishing (so that others will trust it came from you).
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project flexjson: Failed to deploy artifacts: Could not transfer artifact net.sf.flexjson:flexjson:jar:3.2 from/to sonatype-nexus-staging (https://oss.sonatype.org/service/local/staging/deploy/maven2/): Failed to transfer file: https://oss.sonatype.org/service/local/staging/deploy/maven2/net/sf/flexjson/flexjson/3.2/flexjson-3.2.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
regenerate your maven master password and encrypt your password for your nexus repository and configure it in your ~/.m2 settings.xml
Similar to OP, I do not have a distributionManagement section in my pom.xml so I got this error without knowing what to put in the Maven settings file.
The error message above shows the default repository name sonatype-nexus-staging used in the maven release plugin. This is what needs to match the login/password (encrypted or not) in settings.xml.
Keep all your settings file in both %M2_HOME/conf as well as in ~/.m2/ folder.
Then you will not get this error message.
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.
I am new to maven, while using mvn install I've got this error, any idea?
thanks in advance
java.lang.IllegalArgumentException: Invalid uri 'http://maven.mysite.com:9999/repository/npg/data-recovery/${applicationVersion}/data-recovery-${applicationVersion}.pom': escaped absolute path not valid
at hidden.org.apache.commons.httpclient.HttpMethodBase.(HttpMethodBase.java:222)
at hidden.org.apache.commons.httpclient.methods.GetMethod.(GetMethod.java:89)
at org.apache.maven.wagon.shared.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:547)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:491)
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:372)
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:327)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:255)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:163)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedArtifact(MavenMetadataSource.java:94)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.recurse(DefaultArtifactCollector.java:388)
at org.apache.maven.artifact.resolver.DefaultArtifactCollector.collect(DefaultArtifactCollector.java:74)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:316)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:304)
at org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDependencies(DefaultPluginManager.java:1492)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:435)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41)
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.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)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Mar 04 15:12:56 EET 2010
[INFO] Final Memory: 19M/35M
You are using <version>${applicationVersion}</version> somewhere (maybe in this POM or maybe in a parent POM if the version is inherited) but this property is not resolved. You need to define something like this:
<project>
<properties>
<applicationVersion>x.y.z</applicationVersion>
</properties>
...
</project>
Note that I don't really see the point of using such a property, there is a built in ${project.version} property that refers to the version of the project (that you can use in dependencies for example). Check the MavenPropertiesGuide for more details on available properties.
The property ${applicationVersion} is not resolved in the URI path shown:
'http://maven.mysite.com:9999/repository/npg/data-recovery/${applicationVersion}/data-recovery-${applicationVersion}.pom'
I guess this is a dependency configured in your pom. You should locate "data-recovery" among the dependencies in your pom.xml - my bet is that its <version> property is set to ${applicationVersion}. If so, you should set the concrete version for it.
I have the same issue while using a property to set parent pom version in my child module.
You can use maven release plugin to achieve this. Just update version in your parent pom file and run this command to update version in your child module from parent folder:
mvn -N versions:update-child-modules
If I type the command:
mvn dependency:list
The docs suggest that I'll get a list of my project's dependencies. Instead though, I get this:
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] -----------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] -----------------------------------------------------------
[INFO] Required goal not found: dependency:list
Call me a hopeful naive, but I had hoped maven would download any plugins it didn't have. Does anyone know what might be leading to this error? Does anyone know where maven stores information about what plugins it has installed, and where they're stored in the maven repository?
Have you tried mvn -cpu dependency:list (or: mvn --check-plugin-updates dependency:list)? Probably, you have older version of dependency plugin which does not have goal list
If this does not help, try upgrading Maven. Since 2.0.9 default versions are provided by the Super POM for most important plugins (dependency plug-in included), so 2.0 version will be downloaded (which has list goal).
Or you can try removing the cached version of the plug-in from the repository (~/.m2/repository/org/apache/maven/plugins/maven-dependency-plugin/, where ~ is the user home directory).
I have gotten a similiar result from being behind the corporate firewall. Proxy settings in your config (settings.xml) might be the answer.
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<username>user</username>
<password>passwrd</password>
<protocol>http</protocol>
<host>example.proxy.name.com</host>
<port>80</port>
</proxy>
</proxies>
To answer my own question, thanks to some comments that were made on it, the settings.xml file had been customized and did not list the central maven repository.
Oops.
Many Maven troubles can be solved easier by knowing all the details of the failed attempt when posting to forums (answering many of the follow-up questions folks above posted) or mailing list, and this is accomplished by running Maven with the debug and exception option switches like so: mvn <yourgoal> -X -e
Sample output then will look like this:
[~/Documents/Temp/Scratch] mvn clean -e -X
Using Java version: 1.6
+ Error stacktraces are turned on.
Maven version: 2.0.9
Java version: 1.6.0_07
OS name: "mac os x" version: "10.5.6" arch: "x86_64" Family: "mac"
[DEBUG] Building Maven user-level plugin registry from: '/Users/mccm06/.m2/plugin-registry.xml'
[DEBUG] Building Maven global-level plugin registry from: '/Applications/Dev/apache-maven/conf/plugin-registry.xml'
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [clean]
[INFO] ------------------------------------------------------------------------
[DEBUG] Retrieving parent-POM: org.apache.maven.plugins:maven-plugins::10 for project: null:maven-clean-plugin:maven-plugin:2.2 from the repository.
[DEBUG] Retrieving parent-POM: org.apache.maven:maven-parent::7 for project: org.apache.maven.plugins:maven-plugins:pom:10 from the repository.
[DEBUG] Retrieving parent-POM: org.apache:apache::4 for project: org.apache.maven:maven-parent:pom:7 from the repository.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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.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.plugin.MojoExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:377)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 16 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Mon Feb 16 10:59:39 MST 2009
[INFO] Final Memory: 2M/7M
[INFO] ------------------------------------------------------------------------
Try latest maven version, usually upgrades to newer versions solve issues.
While unrelated to your issue being fixed, first you should execute install and only then try executing goals for your plugin.