Jahia6.6 deployment error in maven-built module - java

I am trying to develop a template-set module for a Jahia site.
I used the step-by-step procedure described in the official documentation available here : http://www.jahia.com/cms/home/download/jahia-academy/documentation.default.html?displayTab=technical-documentation "Templating and Integration Guide".
Basically, it implies to use an maven archetype to initialize, build and deploy your project on the server. The two first steps are correctly done. It generates the module's skeleton and mandatory files. Then, I can build it to create a .war file.
mvn archetype:generate -DarchetypeCatalog=http://maven.jahia.org/maven2
>> [INFO] PROJECT GENERATED
mvn clean install
>> [INFO] BUILD SUCCESS
But an error occurs during the deployment.
mvn jahia:deploy
>> [INFO] BUILD FAILURE
>> [ERROR] Failed to execute goal org.jahia.server:maven-jahia-plugin:2.81:deploy (default-cli) on project test-template-set:
>> Error while validating deployers:Factory not initialized properly,
>> you must set the targetServerDirectory variable before calling getInstance ! -> [Help 1]
>> [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The provided link gives me a self explanatory conclusion :
Unlike many other errors, this exception is not generated by the Maven
core itself but by a plugin. The concrete meaning of the exception
depends on the plugin so please have a look at its documentation.
So after using a standard procedure described in the Jahia Documentation, the only piece of advice I could find is to have a closer look at it. Welcome to the catch-22 side of life.
I am using Jahia6.6.1.0 community distribution. I found no further clues in the Jahia fora.
I would like to know which step did I miss. Is this a common maven error ? Or is it just a Jahia mandatory file missing ?
A clue to find a "helloworld working module" would be great as well.
Here is the complete trace of the error :
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test Cooptation template set 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-jahia-plugin:2.81:deploy (default-cli) # test-template-set ---
[INFO] Jahia project structure version is 2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.456s
[INFO] Finished at: Thu Apr 25 14:39:19 CEST 2013
[INFO] Final Memory: 12M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jahia.server:maven-jahia-plugin:2.81:deploy (default-cli) on project test-template-set: Error while validating deployers:
Factory not initialized properly, you must set the targetServerDirectory variabl
e before calling getInstance ! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jahia.server:maven-jahia-plugin:2.81:deploy (default-cli) on project test-template-set: Error while validating deployers
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
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:320)
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.apache.maven.plugin.MojoExecutionException: Error while validating deployers
at org.jahia.utils.maven.plugin.DeployMojo.doValidate(DeployMojo.java:129)
at org.jahia.utils.maven.plugin.AbstractManagementMojo.execute(AbstractManagementMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.RuntimeException: Factory not initialized properly, you must set the targetServerDirectory variable before calling getInstance !
at org.jahia.configuration.deployers.ServerDeploymentFactory.getInstance(ServerDeploymentFactory.java:74)
at org.jahia.utils.maven.plugin.DeployMojo.doValidate(DeployMojo.java:127)
... 22 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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The Prerequisites - by Jahia mentions that we should at least adjust the target path to our Apache Tomcat application server and, in case you will build Jahia from sources code and deploy it, the DB connection settings.
The minimal settings.xml file for deploying Jahia on a Tomcat and using MySQL DBMS is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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">
<localRepository>C:/development/m2repository</localRepository>
<servers>
<server>
<id>jahiaRepository</id>
<username>maven</username>
<privateKey>C:/putty/maven.jahia.org.private</privateKey>
</server>
</servers>
<profiles>
<profile>
<id>jahia-mysql</id>
<properties>
<jahia.configure.databaseType>mysql</jahia.configure.databaseType>
<jahia.configure.databaseUrl>jdbc:mysql://localhost/jahia?useUnicode=true&characterEncoding=UTF-8&useServerPrepStmts=false</jahia.configure.databaseUrl>
<jahia.configure.databaseUsername>root</jahia.configure.databaseUsername>
<jahia.configure.databasePassword>password</jahia.configure.databasePassword>
</properties>
</profile>
<profile>
<id>jahia-tomcat</id>
<properties>
<jahia.deploy.targetServerType>tomcat</jahia.deploy.targetServerType>
<jahia.deploy.targetServerDirectory>C:/development/apache-tomcat-6.0.32</jahia.deploy.targetServerDirectory>
<jahia.deploy.targetServerVersion>6</jahia.deploy.targetServerVersion>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>jahia-mysql</activeProfile>
<activeProfile>jahia-tomcat</activeProfile>
</activeProfiles>
<pluginGroups>
<pluginGroup>org.jahia.server</pluginGroup>
</pluginGroups>
</settings>
I hope this may help.

Related

Error When Building App with Maven Using Heroku

I'm trying to deploy my Discord bot using Heroku but everytime I deploy it, it gives me an error. The code works on local using IntelliJ Idea. Can anyone help me correct this error please?
Build log:
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 21 source files to /tmp/build_8fdb6208/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.237 s
[INFO] Finished at: 2021-03-21T23:52:06Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project CalciteDiscordBot: Fatal error compiling: invalid target release: 15 -> [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
! ERROR: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
! Push rejected, failed to compile Java app.
! Push failed
Here's my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>CalciteDiscordBot</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.target>15</maven.compiler.target>
<maven.compiler.source>15</maven.compiler.source>
</properties>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.2.0_168</version>
</dependency>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</project>
Someone just helped me with this issue yesterday your Maven POM specifies that you want Java 15, but the Java version installed cannot handle compilation for 15. So, add a system.properties file to your application root with the following contents and build again:
java.runtime.version=15
You application requires Java 15 (<maven.compiler.source>15</maven.compiler.source>) so you need tell Heroku you want that specific Java version (instead of the default one)
In the root folder place a file system.properties:
java.runtime.version=15

Install a jar through maven in Netbeans fail to see the location of pom.mxl

I have a Maven project in Netbeans.
I have locally a jar which I want to insert to the project.
Through cmd I run the command
C:\Users\Alia-PC>mvn install:install-file-Dfile=C:\opt\glassfish4\glassfish\dom ains\domain1\applications\myproject\files\rrunner_ja r\Ropt-Updated.jar \ -DgroupId=rcaller -DartifactId=RCaller \-Dversion=2.4 -Dpackaging=jar -e
But I receive this error for pom.xml.
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.094 s
[INFO] Finished at: 2016-05-23T14:27:42+03:00
[INFO] Final Memory: 5M/77M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
in this directory (C:\Users\Alia-PC). Please verify you invoked Maven from the
correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requi
res a project to execute but there is no POM in this directory (C:\Users\Alia-PC
). Please verify you invoked Maven from the correct directory.
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:84)
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:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProject
Exception
Even if I tried to make a
cd C:\opt\glassfish4\glassfish\domains\domain1\applications\myproject\
can anyone tell me the cause of problem and how to fix it?
It's a two step process:
To Install 3rd party jar in local:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
Making the jar available to your project:
Specify the jar dependency in your pom with the same detail which you have defined while installing it locally and build your project from your project directory.
<dependency>
<groupId>Specified GroupID</groupId>
<artifactId>Specified ArtifactID</artifactId>
<version>Specified Version</version>
</dependency>
What this error is saying to me is that you are trying to build from a directory other than your project directory where no pom is defined.
Ideal Maven folder structure:
Project
|
---src
|
---main
|
---java
---so on
---test
|
---so on
---Pom.xml

Receiving 401 error code while doing a release:perform from my maven build

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.

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.

Maven complaints about Joda-Time even though I installed it

Because I want to use ActiveAndroid and ActiveAndroid-Validation I need to use Maven (which I never heard of until yesterday). So I installed maven and then tried to install ActiveAndroid.
I wrote a custom serializer in ActiveAndroid using JodaTime and included a JodaTime jar in the ActiveAndroid libs folder. When I build the project using ant it works perfectly well. Using Maven I first downloaded and installed JodaTime in Maven using mvn clean install from within the JodaTime source folder. Seeing the following lines this was successful:
[INFO] --- maven-install-plugin:2.4:install (default-install) # joda-time ---
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.jar
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/pom.xml to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.pom
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3-javadoc.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3-javadoc.jar
[INFO] Installing /Users/kramer65/Downloads/joda-time-2.3/target/joda-time-2.3-sources.jar to /Users/kramer65/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47.603s
[INFO] Finished at: Thu Sep 26 13:00:54 CEST 2013
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
I then tried to install ActiveAndroid using the same mvn clean install from within the ActiveAndroid source folder. This however, resulted in the following errors:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.095s
[INFO] Finished at: Thu Sep 26 13:01:08 CEST 2013
[INFO] Final Memory: 13M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project activeandroid: Compilation failure: Compilation failure:
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[3,21] package org.joda.time does not exist
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[22,16] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[7,24] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[19,26] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[ERROR] /Users/kramer65/dev/repos/ActiveAndroid/src/com/activeandroid/serializer/JodaDateTimeSerializer.java:[27,28] cannot find symbol
[ERROR] symbol : class DateTime
[ERROR] location: class com.activeandroid.serializer.JodaDateTimeSerializer
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :activeandroid
Does anybody know how I can solve this? All tips are welcome!
==EDIT==
The pom.xml of ActiveAndroid can be found here. I did not change anything in it.
If your IDE does not complain, it means your IDE could build the project.
Then I assume your IDE does not rely on maven to build. I would recommand a stronger integration between maven and your IE.
You are not supposed to manually add the libs to your classpath (in IDE)
Your POM miss the dependency
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
As you have the android-maven-plugin in your build, you need to supply path to the SDK. For this maven plugin, this is done by adding it as property (android.sdk.path) in the properties section of the POM.
So you'll have something like this:
<properties>
<android.sdk.path>your/path/here</android.sdk.path>
</properties>
For quick solution, you can just add this to the POM's properties section. However, local settings like this usually go to settings.xml file in the conf dir inside your maven installation. This will make this property always present no matter what pom you use. Or, if you skip the activeProfiles part, you'll have to invoke maven with that profile enabled - "mvn -pandroidProfile clean install".
<profiles>
<profile>
<id>androidProfile</id>
<properties>
<android.sdk.path>your/path/here</android.sdk.path>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>androidProfile</activeProfile>
</activeProfiles>

Categories