I have a maven project, which has a library (hello1.jar), that I add with IDEA. In this jar file I have the class ru.training.Hello1. In project I have the class Hello2, which contains field Hello1 hello1. When I try to compile the project with maven lifecycle, I get an error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project Learning: Compilation failure: Compilation failure:
[ERROR] /C:/Projects/Learning/src/main/java/reflection/Hello2.java:[3,19] package ru.training does not exist
[ERROR] /C:/Projects/Learning/src/main/java/reflection/Hello2.java:[7,13] cannot find symbol
[ERROR] symbol: class Hello1
What can I do to fix this error?
In this case you need to add local jar file to local repository and then compile the project. How to add local jar I have read here: How to add local jar files to a Maven project?
Related
I have this project: https://github.com/gdesouzacrispim/closure-compiler-minify using closure compiler maven plugin (https://github.com/blutorange/closure-compiler-maven-plugin) where exist a module parent and children;
The plugin is declared in parent pom but it dont have directory path configured int tag baseSourceDir but the children have
Is there any configuration that will ignore when the files isnt existent to be minified in parent module?
[ERROR] Failed to execute goal com.github.blutorange:closure-compiler-maven-plugin:2.22.0:minify (default-minify) on project parent: Execution default-minify of goal com.github.blutorange:closure-compiler-maven-plugin:2.22.0:minify failed: basedir /home/myuser/dev/closure-compile/parent/src/main/webapp/resources does not exist -> [Help 1]
strong text
my build fails when i perform a maven clean install:
i have the following error:
Failed to execute goal org.owasp:dependency-check-maven:5.3.2:check (default) on project
[ERROR] bcpg-jdk15on-1.56.jar: CVE-2005-0366
[ERROR] cucumber-jvm-deps-1.0.5.jar\META-INF/maven/com.thoughtworks.xstream/xstream/pom.xml: CVE-2017-7957, CVE-2016-3674
is there a command to not to fail on error ,tahnks
I would set <failOnError> on false in the configuration of the dependency check maven plugin.
I have a multi-module Maven project in one root project I just want to add another maven module in the root project which contains many module, so after calling the parent from the pom.xml child I get the following error:
parent pom:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-dep-mgt (default) on project calender: Found Dependency errors.
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-dep
-mgt (default) on project calender: Found Dependency errors.
analyze-dep-mgt is a mojo which detects whenever there are dependency mismatches during the final resolution of the build. (https://maven.apache.org/plugins/maven-dependency-plugin/analyze-dep-mgt-mojo.html)
There is likely to be a problem with your dependencies. Check this documentation for more info on how to structure your poms. (https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html)
I recently had this error when adding a new dependency in which a transitive dependency was causing the same goal fail. Using an older version of the dependency resolved the issue.
i am using
D:\project\adaptor>mvn clean install -DskipTests
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
3.2:compile (default-compile) on project adaptor: Compilation failure:
unable to create jar file inside .m2 repository
I've created a Vaadin project using maven, and installed the war in my local maven repository.
This project defines a public class, com.whatever.User.
Then, I created an sbt project wherein I'd like to add a depenecy on the Vaadin project - in order to test it's logic. In the build.sbt file of my sbt project I've added:
resolvers += "Local Maven Repository" at "file://"+Path.userHome+"/.m2/repository"
libraryDependencies ++= Seq(
"com.whatever" % "something" % "1.0"
)
After reloading the sbt project I tried using the User object from inside the sbt project. But I'm getting this error:
> test
[info] Compiling 1 Scala source to /Users/me/projects/something-test/target/scala-2.9.1/classes...
[error] /Users/me/projects/something-test/src/main/scala/TryingUser.scala:1: object whatever is not a member of package com
[error] import com.whatever.User
[error] ^
[error] one error found
[error] {file:/Users/me/projects/something-test/}default-1bc94a/compile:compile: Compilation failed
[error] Total time: 3 s, completed 2012-apr-25 13:44:56
what am I missing? Why isn't sbt adding this dependency?
I can't see sbt, or indeed any other build tool, being able to use war files as dependencies. Think about what the classpath passed to javac or java would look like. The compiler will presumably just see it as a standard zip file and won't be aware that the actual classes are in WEB-INF/classes.
I think you'd need to package the classes as a jar file and use that as a dependency.