maven and lift using scala 2.8 : lift-mapper missing? - maven-2

Newbie question since I'm not up to speed using
maven at all.
I'm trying to use scala + lift using scala 2.8, environment
is a win7 box if that matters.
I create a basic project using:
mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=2.0-scala280-SNAPSHOT -DarchetypeRepository=http://scala-tools.org/repo-snapshots -DremoteRepositories=http://scala-tools.org/repo-snapshots -DgroupId=com.liftworkshop
-DartifactId=todo -Dversion=1.0-SNAPSHOT
So far so good, but then, I try to cd into my new project
and do:
mvn jetty:run
I after quite a few downloads end up with a error like below:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) net.liftweb:lift-mapper:jar:2.0-scala280-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=net.liftweb -DartifactId=lift-mapper -D
version=2.0-scala280-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=net.liftweb -DartifactId=lift-mapper -Dve
rsion=2.0-scala280-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Dr
epositoryId=[id]
Path to dependency:
1) com.liftworkshop:todo:war:1.0-SNAPSHOT
2) net.liftweb:lift-mapper:jar:2.0-scala280-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
com.liftworkshop:todo:war:1.0-SNAPSHOT
from the specified remote repositories:
scala-tools.snapshots (http://scala-tools.org/repo-snapshots),
scala-tools.releases (http://scala-tools.org/repo-releases),
central (http://repo1.maven.org/maven2)
Any ideas?

I created the same project using the mvn archetype:generate command you provided but I couldn't reproduce your problem. The lift-mapper-2.0-scala280-SNAPSHOT.jar artifact is definitely in the scala snapshots repository and Maven downloaded it:
...
1619K downloaded (lift-mapper-2.0-scala280-SNAPSHOT.jar)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '0c857e2c5de9d5cabb7c972e519528606f19697b'; remote = 'a258cf7d7a49a8d7163d499da06a4d1e231a78e0' - RETRYING
Downloading: http://scala-tools.org/repo-snapshots/net/liftweb/lift-mapper/2.0-scala280-SNAPSHOT/lift-mapper-2.0-scala280-SNAPSHOT.jar
1619K downloaded (lift-mapper-2.0-scala280-SNAPSHOT.jar)
As you can see, Maven had to retry the download because of a failed CHECKSUM check but it worked.
Just try again.

Related

gitlab-ci Auto Devops: mvn: command not found on test step

I tried to enable an "Auto Devops" pipeline for my private project on Gitlab.com. The "Build" step runs fine, but then the "Test" step fails. What's strange is that the beginning of the step goes well (the mvn test-compile part), but then it seems to lose the path to mvn:
$ # Auto DevOps variables and functions # collapsed multi-line command
$ setup_test_db
$ cp -R . /tmp/app
$ /bin/herokuish buildpack test
-----> Java app detected
-----> Installing JDK 1.8... done
-----> Installing Maven 3.3.9... done
-----> Executing: mvn clean dependency:resolve-plugins test-compile
[INFO] Scanning for projects...
<SNIP>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.953 s
[INFO] Finished at: 2018-04-01T17:22:11+00:00
[INFO] Final Memory: 23M/169M
[INFO] ------------------------------------------------------------------------
/tmp/buildpacks/05_buildpack-java/bin/test: line 24: mvn: command not found
There is a bug in heroku java buildpack < v60 that will mess with maven installation during tests execution.
It has been fixed and bundled in herokuish 0.4.1
If you re-run your autodevops now it will work.
source: https://gitlab.com/gitlab-org/gitlab-ce/issues/44980

cms.war - No such file or Directory

I try to install a test version of hippocms. I stuck in
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45:21 min
[INFO] Finished at: 2017-02-16T15:18:32+01:00
[INFO] Final Memory: 16M/200M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:start (cargo-run) on project gogreen: Execution cargo-run of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:start failed: Failed to create deployable with implementation class org.codehaus.cargo.container.tomcat.TomcatWAR for the parameters (container [id = [tomcat8x]], deployable type [war]). InvocationTargetException: Failed to parse Tomcat WAR file in [/courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war]: Failed to find file [/courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war]: /courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war (No such file or directory) -> [Help 1]
Any idea?
Today I repeat mvn clean install -X and it worked fine.
For every other guy who came here by search: The -Pcargo.run uses tomcat and the built-in tomcat-users.xml so the only valid account is admin and password admin like tomcat does.
Have you tried a clean install before running cargo?
mvn clean install && mvn -Pcargo.run
edit:
The more modern way of doing it would be:
mvn clean verify
and then do your cargo.run.
see also Build Project

Maven: Trouble deploying third party JAR to a remote repository

I'm using Maven 3. I'm trying to deploy a third party artifact to a remote repository but am getting a strange error. The command I'm using to deploy is
mvn deploy:deploy-file -DgroupId=com.myco.util.ant \
-DartifactId=selenium-ant-task \
-Dversion=1.4 \
-Dpackaging=jar \
-Dfile=/Users/davea/.m2/repository/com/myco/util/ant/selenium-ant-task/1.4/selenium-ant-task-1.4.jar \
-DrepositoryId=sonatype-nexus \
-Durl=http://sonatype.myco.com/nexus/content/repositories/releases
And the error I get when I run this command is
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) on project maven-selenium-plugin: The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file are missing or invalid -> [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.
What's going on here? I have defined my repositoryId, "ssonatype-nexus" in my ~/.m2/settings.xml file and verified the credentials in there are correct.
Thanks for any help, - Dave
deploy:deploy-file is not intended to be run in a directory with a pom.xml file - you should run it somewhere else. If you want a specific POM uploaded with it, don't forget the -DpomFile argument as the default is to generate a basic one.
However, I notice that you're deploying a file from the local repository - if this was placed there by a Maven build you are certainly better to have that project do the deployment, using the <distributionManagement> element and deploy lifecycle phase.
Seems like your url is formatted incorrectly.
Try:
-Durl=file://path_to_m2_repo
See here for more.
Edit: Note, the URL is for the local repo in this case. Maven should deploy to a Nexus based on the POM and -DrepositoryId.

maven : getting dependency details (Equinox)

New to maven and equinox. While going through a tutorial on OSGi, I issued the following commmand.
pax-provision
which gave the following error.
-> Provision bundle [mvn:org.compass-project/compass/2.1.1, at default start level, bundle will be started, bundle will
be loaded from the cache]
-> Preparing framework [Equinox 3.6.0]
-> Downloading bundles...
-> Equinox 3.6.0 : connecting...
___
/ /
/ / Oops, there has been a problem!
/ /
/__/ URL [mvn:org.eclipse.osgi/org.eclipse.osgi/3.6.0.v20100517] could not be resolved.
___
/__/ Use --log=debug to see details.
Seems like the Equinox build is not available in the repository. So
1. Where to look for the repository which has the correct version. Is there any command or search tool??
2. I read, I may be able to install it locally, with the below command
mvn install:install-file -DgroupId=<your_group_name> \
-DartifactId=<your_artifact_name> \
-Dversion=<snapshot> \
-Dfile=<path_to_your_jar_file> \
-Dpackaging=jar \
-DgeneratePom=true
How can I get all those parameters (group id, artifactId etc)?
I could find 2 resource where I can get mvn packages.
http://mvnrepository.com/ and http://maven.ozacc.com/ . Please comment if this is the right place. I could get the artifact id etc from the search result. thanks

I am unable to run maven2

I am not able to run Maven 2.1. I get following Error while running:
****************************************************************
naresh#HYRDSRVIHUB01:~/.m2> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: Connection refused
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Jul 22 17:59:02 IST 2010
[INFO] Final Memory: 3M/240M
[INFO] ------------------------------------------------------------------------
******************************************************************
Help me to get rid of it.
As already pointed out, you are running Maven. However, depending on what you're asking Maven to do, Maven might have to download libraries from a remote repository: plugins, dependencies, etc that are then stored in your local repository and downloading libraries from a remote repository requires a connection.
If you start using Maven with an empty local repository, this is something you can't avoid and you'll have to let Maven download what it needs first.
Sure, you can run Maven offline (using the -o or --offline command line optionsbut this will work only if you already have the required stuff in your local repository.
Oh, and by the way, I'm not sure it's really wise to create a project under your ~/.m2 directory. You should run archetype:create from another location, e.g. ~/Projects.
Your running maven, the issue is either with your connection it seems to be getting rejected by the maven repo:
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: Connection refused