I'm trying to install OpenTripPlanner following the official tutorial.
I've correctly cloned the git repository, then I import the project in Eclipse but it is unable to build all the packages. One of the error is "The import org.geotools cannot be resolved"
So I've tryed with the Maven tutorial but when I run "mvn install integration-test -DskipTests -P interactive" I get:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.geotools:library:pom:null
Reason: Cannot find parent: org.geotools:modules for project: org.geotools:library:pom:null for project org.geotools:library:pom:null
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Mon May 20 15:53:31 CEST 2013
[INFO] Final Memory: 44M/473M
[INFO] ------------------------------------------------------------------------
Googling, I've not found anything similar, so, what's the matter?
seems that the geotools.version (and other) properties are not set in the main pom (https://github.com/openplans/OpenTripPlanner/blob/master/pom.xml).
Probably the hudson builder is using variables coming from the settings.xml.
Try defining it manually:
mvn install integration-test -DskipTests -Pinteractive -Dgeotools.version=9.1 -Dspring.version=3.1.1.RELEASE
Related
I am trying to warm up my Docker + Maven cache before building a Kotlin project.
As suggested by many Maven/Docker threads, my docker file looks like this:
COPY pom.xml .
RUN mvn dependency:go-offline
COPY ./src/ src/
RUN mvn package
The thought is that if I change a file in the ./src directory, I want docker cache to skip maven's lengthy dependency download page.
My problem is that the mvn package command still downloads alot of files.
I tried to use mvn -o package (maven offline flag) to diagnose what dependencies are missing, but it just complains that it cannot download dependencies. But I would have expected that the dependencies would allready be downloaded in the previous step. Here are the errors that I get with the "-o" flag:
Step 8/13 : RUN mvn dependency:go-offline
---> Using cache
---> 0334facb9cc9
Step 9/13 : COPY ./src/ src/
---> Using cache
---> 27149a191017
Step 10/13 : RUN mvn -o package
---> Running in 5183eced32ca
Warning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building auth 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # auth ---
[WARNING] The POM for org.apache.maven:maven-core:jar:2.0.6 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-monitor:jar:2.0.6 is missing, no dependency information available
[WARNING] The POM for org.codehaus.plexus:plexus-utils:jar:2.0.5 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.shared:maven-filtering:jar:1.1 is missing, no dependency information available
[WARNING] The POM for org.codehaus.plexus:plexus-interpolation:jar:1.13 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.882 s
[INFO] Finished at: 2019-07-12T07:02:23+00:00
[INFO] Final Memory: 13M/174M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project auth: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.0.6, org.apache.maven:maven-project:jar:2.0.6, org.apache.maven:maven-profile:jar:2.0.6, org.apache.maven:maven-artifact-manager:jar:2.0.6, org.apache.maven:maven-repository-metadata:jar:2.0.6, org.apache.maven:maven-plugin-registry:jar:2.0.6, org.apache.maven:maven-core:jar:2.0.6, org.apache.maven:maven-artifact:jar:2.0.6, org.apache.maven:maven-settings:jar:2.0.6, org.apache.maven:maven-model:jar:2.0.6, org.apache.maven:maven-monitor:jar:2.0.6, classworlds:classworlds:jar:1.1-alpha-2, org.codehaus.plexus:plexus-utils:jar:2.0.5, org.apache.maven.shared:maven-filtering:jar:1.1, org.codehaus.plexus:plexus-interpolation:jar:1.13: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven:maven-plugin-api:jar:2.0.6 has not been downloaded from it before. -> [Help 1
Try following mvn commands, it saved me from the maven error.
RUN mvn --batch-mode --errors --strict-checksums --threads 1C \
org.apache.maven.plugins:maven-dependency-plugin:3.0.2:go-offline
RUN mvn --batch-mode --errors --offline package
From what I gathered from various sources go-offline not always handles caching packages in a correct way, leaving some of them outside of the local repository (see pull request on GitHub).
In my case, the standard mvn dependency:go-offline used go-offline 2.8 and returned errors. I then tried running mvn org.apache.maven.plugins:maven-dependency-plugin:3.2.0:go-offline but I still had some issues with different packages.
What worked for me was using a different "go-offline" plugin available at GitHub.
Using
mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies
finally did the job.
When creating a new Vaadin 8.1.0 app named bogus using the archetype vaadin-archetype-application-multimodule, the build fails in IntelliJ 2017.2 when running Maven Projects panel > bogus-ui > Plugins > jetty > jetty:run
I get these error messages on console.
/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/basilbourque/IdeaProjects/bogus/bogus-ui "-Dmaven.home=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3" "-Dclassworlds.conf=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/m2.conf" "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55637:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.2 org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run
objc[11304]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java (0x1060bd4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10712c4e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building bogus-ui 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:9.3.9.v20160517:run (default-cli) > test-compile # bogus-ui >>>
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/maven-metadata.xml
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/bogus-backend-1.0-SNAPSHOT.pom
[WARNING] The POM for com.example:bogus-backend:jar:1.0-SNAPSHOT is missing, no dependency information available
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/bogus-backend-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.334 s
[INFO] Finished at: 2017-07-30T22:58:18-07:00
[INFO] Final Memory: 11M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project bogus-ui: Could not resolve dependencies for project com.example:bogus-ui:war:1.0-SNAPSHOT: Could not find artifact com.example:bogus-backend:jar:1.0-SNAPSHOT in vaadin-addons (http://maven.vaadin.com/vaadin-addons) -> [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/DependencyResolutionException
Process finished with exit code 1
Using Java 8 Update 144 on macOS Sierra 10.12.5 with IntelliJ Ultimate edition 2017.2.
The linked Question, Maven: How to use jetty:run in a multi-module Maven project, without needing to install, is not a duplicate of this Question. That one asks about one module (the Web Module) picking up on changes made in other modules and causing a rebuild rather than retrieving built items from local repository. I am asking how to run the app in the first place, long before needing to trigger re-builds.
Lifecycle > install on root/parent module
Maven needs to find dependencies before running.
You need to run 'mvn install' on root (parent) project or on your backend module (and other project that backend depends on).
you need to run mvn clean install command on the the parent project from root directory>
I have a maven build which I would like to execute the jar creation for, but mvn package fails due to unit test failures.
I'd like to still build the jar in spite of the fact that some tests fail, I tried
mvn package -Dtest=false -DfailIFNoTests=false
But that fails.
mvn jar:jar seems to work, but I'd rather use the more idiomatic mvn package approach.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.119s
[INFO] Finished at: Mon Mar 11 12:07:16 EDT 2013
[INFO] Final Memory: 9M/234M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project glusterfs: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
The surefire plugin controls test running and failure reporting.
mvn package -Dmaven.test.failure.ignore=true
should compile and run your tests, but not fail the whole build if some of the tests fail. (I've never used this, going on reading docs only.)
You can skip running unit tests with the following:
-Dmaven.test.skip=true
I am using Maven to integrate our project with others, maybe in a unpopular way and encountered issue.
We have a project that used to compile with Ant. Ant script is big and awesome, so when we are using Maven for integration, it is decided to keep compiling with Ant.
Now let's say Ant compile output is res-1.0-SNAPSHOT.tar.gz. (any filename can be possible but it IS tar.gz) And I am deploying the file to a nexus-hosted snapshot repository called "snapshots".
I tried to deploy with this command:
mvn deploy:deploy-file \
-DgroupId="com.my-company" \
-DartifactId="res" \
-Dversion="1.0-SNAPSHOT" \
-Dpackaging="tar.gz" \
-Dfile="res-1.0-SNAPSHOT.tar.gz" \
-Durl="http://our-nexus-ip/nexus/content/repositories/snapshots" \
-DrepositoryId="snapshots"
I have a simple settings.xml in ~/.m2 with proxy and server settings. However server settings is not being used in current progress yet, wrong passwords don't get errors.
The output is like this:
[[root#cnbi maven]# ./run.sh
+ mvn deploy:deploy-file -DgroupId=com.my-company -DartifactId=res -Dversion=1.0-SNAPSHOT -Dpackaging=tar.gz -Dfile=res-1.0-SNAPSHOT.tar.gz -Durl=http://135.252.234.142:8081/nexus/content/repositories/snapshots -DrepositoryId=snapshots
Warning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'deploy'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [deploy:deploy-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [deploy:deploy-file]
[INFO] Retrieving previous build number from snapshots
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error retrieving previous build number for artifact 'com.my-company:res:tar.gz': repository metadata for: 'snapshot com.my-company:res:1.0-SNAPSHOT' could not be retrieved from repository: snapshots due to an error: Error transferring file
Server returned HTTP response code: 503 for URL: http://135.252.234.142:8081/nexus/content/repositories/snapshots/com/my-company/res/1.0-SNAPSHOT/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 51 seconds
[INFO] Finished at: Tue Jun 12 08:44:13 CST 2012
[INFO] Final Memory: 7M/209M
[INFO] ------------------------------------------------------------------------
You see, it fails to find maven-metadata.xml. It is for certain, the file and its folder "com/my-company" do not exist at all in the repository.
Besides any misuse of Maven you may find, my questions are:
1) am I using Maven in the right way? (deploying tar.gz, using deploy:deploy-file...)
2) are there incorrect parameters?
3) what is maven-metadata.xml for? It is not there but Maven insists to find it -- I guess it is generated, am I missing some steps?
The solution might be stupid, I am really not familiar with Maven. Unfortunately it has to be done... Please, help me out of this.
Maven version is 2.0.11. Let me know if you want to know more.
I had the same problem and there was a bug in our nexus.
Using maven3 (with same settings.xml, pom.xml and .m2 repo) solved our problem and its easier than upgrading nexus.
You can check this bug also.
If you're still stuck with using Ant, I would recommend you at least consider adding Ivy to the picture, as your dependency manager. If I recall correctly, it was able to update maven-metadata.xml files in the repository.
Have a look at this example.
I'm using Maven 3.0.3 on WinXP and running my Maven build commands through Cygwin. Occassionally, I'll be able to run a maven clean ...
mvn clean install
And I'll get errors like ...
[INFO] Deleting C:\Documents and Settings\E18538\workspace\iteration1\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.891s
[INFO] Finished at: Mon Jan 23 11:07:58 CST 2012
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project myco-productplus-web: Failed to clean project:Failed to delete C:\Documents and Settings\E18538\workspace\iteration1\target -> [Help 1]
Other than Cygwin, I'll close all other applications, but there is still a process holding something in "target". How do I figure out what that process is and then kill it? Note that when I restart my system, I can again run "mvn clean" commands.
Edit: The process that is holding onto the directory in question is "TGitCache.exe", spawned by TortoiseGit, installed on my system. I have marked the "target" directory as one to ignore, so I'm wondering if there's a way to cause this process to ignore target.
Thanks, - Dave
Run mvn -X clean to see the actual error stacktrace to figure out what's wrong. As to check what is locking the directory see unlocker.
Use mvn clean -Dmaven.clean.failOnError=false
to resolve this problem.
I am using Spring(Eclipse) to do a maven clean and already had a command line and cygwin open with target as the current directory. I closed cygwin and other console, did a maven clean on the pom.xml in Spring and it worked!
This link helped me out: http://maven.apache.org/plugins/maven-clean-plugin/faq.html