I started a new Maven project and try to get lagom to work on my Maven project. On my Run Configurations I have inputted lagom:runAll under Command Line. However, when I run my project I get the following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.578 s
[INFO] Finished at: 2020-01-17T11:25:31+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'lagom' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/andrea/.m2/repository), spring-milestones (https://repo.spring.io/milestone), spring-snapshots (https://repo.spring.io/snapshot), central (https://repo.maven.apache.org/maven2)] -> [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/NoPluginFoundForPrefixException
Does anyone understand why I am unable to spot lagom library? Thanks in advance for the help, cheers!
Problem is that Maven does not know anything about external plugins by default, and this extends to modules. Unless told so in the pom.xml (which implicitly implies any parent poms) a module has no knowledge of what happens in other modules.
Either you need to invoke lagom with the full artifact name or you need to configure lagom in your pom.xml (preferably using dependency management in the parent pom)
Related
I have a Maven Project which has a module 'AddUser'. This module is basically a sam application.
When trying to run the command 'sam build' from the project root path. I am getting the below error:-
in-iftekhar-04eb:UserPlanning iftekhar.khan$ sam build
2019-07-14 16:55:00 Building resource 'AddUserFunction'
2019-07-14 16:55:00 Running JavaMavenWorkflow:CopySource
2019-07-14 16:55:00 Running JavaMavenWorkflow:MavenBuild
Build Failed
Error: JavaMavenWorkflow:MavenBuild - Maven Failed: [INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.054 s
[INFO] Finished at: 2019-07-14T16:55:01+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/private/var/folders/f8/jgg9tzq97q39c_c2z1sn4blm0000gn/T/tmprn_uvw70). Please verify you invoked Maven from the correct directory. -> [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/MissingProjectException
The Complete Code can be found here - https://github.com/training-session-101/UserPlanning
Can anyone who has faced similar issue help me in this!
Thanks!
I had this problem. First I ran mvn clean install, then I changed the SAM template so that it didn't point to the jar but to the location of the pom.xml file, like so:
CodeUri: .
and then ran sam build.
The actual situation
I want to use Apache Flink with Kinesis Analytics. Like I don't have experience with Java and Maven and going to try to summary the steps I followed and the results.
Use IntelliJ IDEA as IDE
Test this example without any problems
Change to AWS, following their instruction. The problems start in the step: Create and Compile the Apache Flink Streaming Java Code
The problems
If you want to use the Kinesis connector, you can not do it like other connector due to the ASL license and they do not deploy the artifact to the Maven central repository on Flink releases, so you will need to build the Kinesis connector by yourself download the source code for the connector from here Apache Flink, and install it to your local Maven repository.
After download it, you have build the module following this steps:
mvn clean install -Pinclude-kinesis -DskipTests
So I move to the unziped folder, and run the mvn command, with this error:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 50.670 s
[INFO] Finished at: 2018-12-27T14:35:13+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check (default) on project flink-parent: Too many files with unapproved license: 2 See RAT report in: C:\Users\...\flink-master\target\rat.txt -> [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 :flink-parent
Trying to find a solution, I tried what this user said here
mvn clean install -Pinclude-kinesis -DskipTests -Drat.ignoreErrors=true package
But again, I had an error:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:15 min
[INFO] Finished at: 2018-12-27T14:40:47+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project flink-shaded-hadoop2: Could not resolve dependencies for project org.apache.flink:flink-shaded-hadoop2:jar:1.8-SNAPSHOT: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path C:\Program Files\Java\jdk-11/../lib/tools.jar -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :flink-shaded-hadoop2
The questions
How should I build the connector module?
How should I install it to my local Maven repository?
After receiving similar errors, even after using the other answer's solution for checking out a release branch, I found a solution that works for me. According to the build guide in the Flink docs, you can also add the -Dfast option to speed up build time. In my case, this resolved the licensing errors:
mvn clean install -Pinclude-kinesis -DskipTests -Dfast
I think that the problem is that you're trying to build the "snapshot" build of the Flink connector, not the release build.
Since you're not familiar with Java and Maven, here's what that means: Maven differentiates between "snapshot" builds, which are currently under active development, and "release" builds. Normally a project only pushes its release builds to Maven Central. However, for long-running development, the "master" branch is often a snapshot.
The POM in your linked instructions references version 1.6.2, so that's what you should be building. Check out the tag release-1.6.2, and also make sure that you're reading the Flink documentation for that version (your link above is for the latest development version).
I'm using the command below to download a maven jar from Nexus through the command line.
call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -DrepoUrl=http://10.101.15.190:8081/nexus/content/repositories/releases/ -Dartifact=bits:update-service:1.0.3 -Ddest=Setups/Services/update-service.jar
But what I get is a jar without dependencies. There is already a jar with dependencies in Maven with the name update-service-1.0.4-jar-with-dependencies.jar
I tried the following:
call mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -DrepoUrl=http://10.101.15.190:8081/nexus/content/repositories/releases/ -Dartifact=bits:update-service:1.0.3[:packaging[:jar]] -Ddest=Setups/Services/update-service.jar
But it returns the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.4:get (default-cli) on project standalone-pom: Couldn't download artifact: Missing:
[ERROR] ----------
[ERROR] 1) bits:update-service:packaging[:jar]]:1.0.3[
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=bits -DartifactId=update-service -Dversion=1.0.3[ -Dclassifier=jar]] -Dpackaging=packaging[ -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=bits -DartifactId=update-service -Dversion=1.0.3[ -Dclassifier=jar]] -Dpackaging=packaging[ -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) org.apache.maven.plugins:maven-downloader-plugin:jar:1.0
[ERROR] 2) bits:update-service:packaging[:jar]]:1.0.3[
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] org.apache.maven.plugins:maven-downloader-plugin:jar:1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false),
[ERROR] temp (http://10.101.15.190:8081/nexus/content/repositories/releases/, releases=true, snapshots=true)
[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/MojoExecutionException
Question: What is the correct way to download a jar with dependencies?
jar-with-dependencies in this case is a Maven classifier:
The classifier allows to distinguish artifacts that were built from the same POM but differ in their content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number.
That is, the 1.0.4 jar and its with-dependencies variant differ in their Maven coordinates via the classifier.
Hence, using the maven-dependency-plugin and its get goal you can specify a classifier via the classifier option:
The classifier of the artifact to download. Ignored if artifact is used.
However, you are indeed using the artifact option already, hence the option above will be ignored as per documentation.
If you look at the documentation of the artifact option though:
A string of the form groupId:artifactId:version[:packaging][:classifier].
Look at its last (optional) token, [:classifier]. This is exactly what you are missing.
Your artifact option should be as following:
-Dartifact=bits:update-service:1.0.4:jar:jar-with-dependencies
Note: you actually already used it incorrectly when specifying:
-Dartifact=bits:update-service:1.0.3[:packaging[:jar]]
The squared brackets [..] indicates optional parameters, you should not specify them in your command line invocation. Moreover the packaging string there specify what value to put: again, you should not specify it, but just replace it with the corresponding value (in this case jar).
I have created an example to show you the way.
I would like to download all the dependencies of spring-webmvc in version 4.2.5.RELEASE.
1) You need the pom of webmvc if not already in your local repository. If spring-webmvc is already in the local repo then skip 1).
2) You can download all the dependencies related to the pom your have just downloaded.
downloading of the pom
C:\temp\spring_web_mvc>mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DgroupId=org.springframework -DartifactId=spring-webmvc
-Dversion=4.2.5.RELEASE -Dtype=pom
downloading all the dependencies
C:\temp\spring_web_mvc>mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:copy-dependencies -f C:\repository2\org\springframework\spring-webmvc\4.2.5.RELEASE\spring-webmvc-4.2.5.RELEASE.pom -DoutputDirectory=C:\TEMP
[INFO] Scanning for projects...
[WARNING] Some problems were encountered while building the effective model for org.springframework:spring-webmvc:jar:4.2.5.RELEASE
...
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring Web MVC 4.2.5.RELEASE
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.lowagie:itext:jar:2.1.7.js4 is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.10:copy-dependencies (default-cli) # spring-webmvc ---
[WARNING] The POM for org.apache.maven.doxia:doxia-sink-api:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] org.apache.tiles:tiles-request-mustache:jar:1.0.6 already exists in destination.
[INFO] com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.6.5 already exists in destination.
[INFO] org.apache.tiles:tiles-mvel:jar:3.0.5 already exists in destination.
[INFO] org.apache.tiles:tiles-jsp:jar:2.2.2 already exists in destination.
[INFO] org.jfree:jcommon:jar:1.0.23 already exists in destination.
...
[INFO] org.apache.tiles:tiles-extras:jar:3.0.5 already exists in destination.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.095 s
[INFO] Finished at: 2016-06-23T11:06:03+02:00
[INFO] Final Memory: 14M/241M
[INFO] ------------------------------------------------------------------------
Results:
C:\temp\spring_web_mvc>dir
Volume in drive C has no label.
Volume Serial Number is F400-3CE5
Directory of C:\temp\spring_web_mvc
23/06/2016 11:05 .
23/06/2016 11:05 ..
23/06/2016 10:24 4,467 aopalliance-1.0.jar
23/06/2016 10:24 192,035 bcmail-jdk14-1.38.jar
23/06/2016 10:24 192,035 bcmail-jdk14-138.jar
...
I am trying to create a new Maven project in the terminal, using the following command:
mvn archetype:generate -DgroupId=com.my.domain -DartifactId=myproject -DarchetypeArtifactId=wildfly-javaee7-webapp-archetype -DinteractiveMode=false
So I am trying to use the Wildfly archetype wildfly-javaee7-webapp-archetype.
I am getting the following error...
[INFO] Generating project in Batch mode
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/wildfly-javaee7-webapp-archetype/1.0/wildfly-javaee7-webapp-archetype-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.860 s
[INFO] Finished at: 2016-03-31T14:35:27+02:00
[INFO] Final Memory: 16M/188M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.apache.maven.archetypes:wildfly-javaee7-webapp-archetype:1.0) -> [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
... which means, that Maven is trying to download the archetype at https://repo.maven.apache.org which is not correct, because the archetype is provided by http://mvnrepository.com/artifact/org.wildfly.archetype.
How can I change the source or how can I add additional sources? Or am I missing something different?
You need to define the archetypeGroupId, otherwise, it will default to groupId of Maven default archetypes. Also, you need to define the archetypeVersion.
In this case, you need to have archetypeGroupId=org.wildfly.archetype and archetypeVersion=8.2.0.Final (for example).
Thus, you should have:
mvn archetype:generate -DgroupId=com.my.domain -DartifactId=myproject -DarchetypeGroupId=org.wildfly.archetype -DarchetypeArtifactId=wildfly-javaee7-webapp-archetype -DarchetypeVersion=8.2.0.Final -DinteractiveMode=false
As a side-note, repo.maven.apache.org and mvnrepository.com both are Maven Central and contain the same artifacts.
If anybody else is having problems following the accepted answer try to decrement the version to -DarchetypeVersion=8.1.0.Final
when run the command:mvn jetty:run in the web directory,it's the error message:
[WARNING] The POM for com.mycompany:core:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.015s
[INFO] Finished at: Mon Sep 05 23:31:23 CST 2011
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project web: Could not resolve dependencies for project com.mycompany:web:war:1.0-SNAPSHOT: Failure to find com.myco
mpany:core:jar:1.0-SNAPSHOT in http://oss.sonatype.org/content/repositories/appfuse-snapshots was cached in the local repository, resolution will not
be reattempted until the update interval of appfuse-snapshots has elapsed or updates are forced -> [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
It looks like you have appfuse multi-module web project and you are building the web module without having built/installed the core module.
Quoting the instruction from appfuse quickstart, highlighting relevant portion in bold.
To view your application run mvn jetty:run from your project's
directory (for a modular project, you'll need to run mvn jetty:run
from your project's web directory (after installing the core module)).
You need to run mvn install from the project's root directory also!
In your situation, you definitely need to mvn install from your core directory. If this does not help, then run the same command from root directory. The problem is that one of Your modules needs to be installed and only after that the error you are encountering will be removed.