I'm trying to use project https://github.com/castor-software/decompilercmp. I downloaded from git, noticed it's a maven project, installed maven, then tried to do:
mvn install
and got:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for se.kth:decompiler-cmp:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for scala:jardiff:jar should not point at files within the project directory, ${basedir}/lib/jardiff.jar will be unresolvable by dependent projects # line 34, column 25
[WARNING] 'dependencies.dependency.systemPath' for jd:jd-core:jar should not point at files within the project directory, ${basedir}/lib/jd-core-1.0.0.jar will be unresolvable by dependent projects # line 42, column 25
[WARNING] 'dependencies.dependency.systemPath' for jadx:jadx-cli:jar should not point at files within the project directory, ${basedir}/lib/jadx-0.9.0/lib/jadx-cli-0.9.0.jar will be unresolvable by dependent projects # line 50, column 25
[WARNING] 'dependencies.dependency.systemPath' for cli.jd:jd-gui:jar should not point at files within the project directory, ${basedir}/lib/jd-gui-1.4.1.jar will be unresolvable by dependent projects # line 58, column 25
[WARNING] 'dependencies.dependency.systemPath' for org.jode:jode-decompiler:jar should not point at files within the project directory, ${basedir}/lib/jode-1.1.2-pre1.jar will be unresolvable by dependent projects # line 65, column 25
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: fr.inria.gforge.spoon:spoon-core:jar -> version 7.3.0 vs 7.5.0 # line 163, column 21
[WARNING] 'dependencies.dependency.systemPath' for scala:jardiff:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jardiff.jar # line 34, column 25
[WARNING] 'dependencies.dependency.systemPath' for jd:jd-core:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jd-core-1.0.0.jar # line 42, column 25
[WARNING] 'dependencies.dependency.systemPath' for jadx:jadx-cli:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jadx-0.9.0/lib/jadx-cli-0.9.0.jar # line 50, column 25
[WARNING] 'dependencies.dependency.systemPath' for cli.jd:jd-gui:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jd-gui-1.4.1.jar # line 58, column 25
[WARNING] 'dependencies.dependency.systemPath' for org.jode:jode-decompiler:jar refers to a non-existing file /Users/shlomiagiv/work/decompilercmp/lib/jode-1.1.2-pre1.jar # line 65, column 25
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -----------------------< se.kth:decompiler-cmp >------------------------
[INFO] Building decompiler-cmp 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.483 s
[INFO] Finished at: 2020-05-03T08:13:12+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project decompiler-cmp: Could not resolve dependencies for project se.kth:decompiler-cmp:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: scala:jardiff:jar:1.2.0, jd:jd-core:jar:1.0.0, jadx:jadx-cli:jar:0.9.0, cli.jd:jd-gui:jar:1.4.1, org.jode:jode-decompiler:jar:1.2.1-pre1: Could not find artifact scala:jardiff:jar:1.2.0 at specified path /Users/shlomiagiv/work/decompilercmp/lib/jardiff.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
those missing dependencies are various decompilers the project is trying to reach.
How do I get/point to them? Note that I'm using MacOS
example pom.xml entry for jadx:
<dependency>
<groupId>jadx</groupId>
<artifactId>jadx-cli</artifactId>
<version>0.9.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jadx-0.9.0/lib/jadx-cli-0.9.0.jar</systemPath>
</dependency>
In general, maven uses the concept of remote repostories (like maven central) to look up the dependencies of your project and store them in local repository cache (~/.m2 by default).
You can add your own remote repositories if you want.
If you define a dependency in the system scope however, this means that you instruct maven that the jar is not in a repository and instead its up to you to provide it in the folder that you specify (systemPath). This method effectively bypasses the maven dependency resolution mechanism and in general should not be used for real projects. Instead one should install special products like Nexus or Artifactory that serve as a remote proxy and can host your own JARs as well.
Why should system scope be used at all?
Usually it shouldn't, consider using it only if you have jars that cannot be published to remote repository (your private company's commercial artifacts) and you don't have a nexus/artifactory and don't want to install it (if you're 1 developer that runs stuff on your local machine or something)
If you decide to use the system scope anyway, you're by yourself responsible for "providing" these dependencies to maven, so you should probably find these artifacts by yourself. Once you know where the jars, you can copy them to the folder specified in the systemPath and keep bypassing maven's dependency resolution mechanism.
Another (arguably somewhat better approach) is to stop using system scope at all and once you've found the jars, use mvn install:install-file command to install the file to the local repository cache (~/.m2). You'll be able to specify group id, artifact id, version, and it will store this jar in the correct place. Then you'll be able to refer this jar as a regular maven dependency.
This Link is for tutorial that shows how to work with these "3rd party" jars.
Related
I am using MacOS and I am using Maven in version 3.8.7. I am using Java in 11.0.17 by Eclipse Temurin.
Somehow, when building a big Maven project, Maven creates resolver-status.properties files that contain invalid characters:
.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:3:\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:4:maven-metadata-willhaben-ne\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
.m2/repository/some-project/1.0-SNAPSHOT/resolver-status.properties:8:maven-metadata-shibboleth-\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
A subsequent Maven build is then failing with this error message:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.281 s
[INFO] Finished at: 2023-01-17T09:19:29+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Malformed \uxxxx encoding.
[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.
The error is happening when I run Maven both with one thread and with multiple threads.
How can I fix my build so that Maven no longer writes \u0000 in resolver-status.properties files?
I know suspect that the broken files get downloaded from Nexus when performing the Maven build anew.
On our CI they are built with a somewhat older Maven version and with multiple threads.
I've been working with test automation a lot lately.
Im now familiarized with several tools, frameworks, dependencies, etc. like Selenium, JUNits, TestNG that helps me manage my daily work as a QA Engineer.
I frequently use Selenium and TestNG to build up my solutions, together with IntelliJ IDEA that runs on the latest JDK version (jdk-15.0.1) available on a Mac running on macOs Catalina Version 10.15.7.
I have mi POM.mxl file already configured for my projects and since the very beginning it displayed the following error on the console:
Cannot resolve com.sun:tools:0
I always ignored that because my projects within my IDE always compiled&ran and because I was never using that dependency. But now I'm trying to run my project with maven support from my Terminal in my Mac and because of the sun:tools.jar dependency, I'm not allowed to compile any working project I have developed so far.
I have read a lot of similar threads on similar problems with the same sun:tools:jar dependency like in:
Missing artifact com.sun:tools:jar
Missing Library com.sun.tools.attach
Could not find artifact com.sun:tools:jar:0
I have done everything, but many solutions were based on finding the tools.jar file in the jdk installation directory. Since I'm using JDK 15, this dependency was already removed:
Removed: rt.jar and tools.jar
The class and resource files previously stored in lib/rt.jar,
lib/tools.jar, lib/dt.jar, and various other internal JAR files are
now stored in a more efficient format in implementation-specific files
in the lib directory. The format of these files is not specified and
is subject to change without notice.
I attach the exact error message I get with the terminal:
----------------------< org.example:YelpExercise >----------------------
[INFO] Building YelpExercise 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.737 s
[INFO] Finished at: 2020-11-04T18:59:47-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project YelpExercise: Could not resolve dependencies for project org.example:YelpExercise:jar:1.0-SNAPSHOT: Could not find artifact com.sun:tools:jar:0 at specified path /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/../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
Ok, after hours and even days of research, I found the solution:
For JDK 9 and above, when defining the pom.xml, you have to exclude that sub-dependency whenever you will use a dependency that contains it. In my case, the cobertura dependency included sun.com:tools.
What I edited in my pom.xml file:
<!-- https://mvnrepository.com/artifact/net.sourceforge.cobertura/cobertura -->
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
<version>2.1.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
</exclusion>
</exclusions>
</dependency>
This seems to be still an open issue for some maven dependencies. Check: issues1 or issues2 or Google search: <dependency_you_are_using> sun tools for more info.
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 build and run a Spring MVC beginner lesson project using IntelliJ. I imported the existing project from GitHub. But when I try to build the project I keep getting:
Error:(3, 38) java: package org.springframework.stereotype does not exist
Error:(4, 47) java: package org.springframework.web.bind.annotation does not exist
These external dependencies jars are under my Maven local repositories (C:\Users\sudi.m2)and I can see in IntelliJ under Maven->Repositories that repo location is indeed there. I also tried "Invalidate Cache and restart" but that does not help. My M2_HOME is set correctly to C:\apache-maven-3.2.2. If I try to run mvn install from command line, I get:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.845 s
[INFO] Finished at: 2014-09-25T19:03:21+05:30
[INFO] Final Memory: 9M/93M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project basic-web-app: Error assembling WAR: webxml attribute is required (or preexisting WEB-INF/web.xml if executing in update mode) -> [Help 1]
Any suggestions are appreciated.
If the project doesn't have a web.xml file (IE: Entirely java config based). The build war plugin will fail unless you specify the "failOnMissingWebXml" attribute to false.
Delete you local .m2 repository and let it re-download all needed jars. Maybe, there were issues while downloading one of the dependencies.
I'm trying to connect i.lon100 with JAVA using Programmers Reference. pom.xml and .pdf file with Programmer reference can be downloaded from page: http://home.elka.pw.edu.pl/~mkolasin/
My eclipse version is:
Eclipse Java EE IDE for Web Developers.
Version: Juno Service Release 2
Build id: 20130225-0426
Maven version: 2.2.1 (as recomended in programmers reference)
a) First of all I have a problem with page 22-6 with installing Maven Embedder and Maven Integration for Eclipse, becouse I assume that http://m2eclipse.sonatype.org/update/ page doesn't exsist. So, my first question: is there any other site I can download those software using eclipse?
B) I installed from eclipse market: Maven integration for eclipse, but i couldn't find Maven Embedder. And now i have got right click on project: RUN AS - Maven Built instead of Run AS - maven package is it still okay?
c) When i try to make another step page 22-13 "In the Project Explorer view, right-click the ilon-ws folder, point to Run As, and then click
Maven Package. This generates the java proxy classes and builds the jar." i got an error in console and i don't know how to fix it.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org...ticLoggerBinder for further details.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.echelon.es:ilon-ws:jar:4.03-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:jaxws-maven-plugin is missing. # line 71, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 113, column 23
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing. # line 124, column 23
[WARNING] 'repositories.repository.layout' for java.net uses the unsupported value 'legacy', artifact resolution might fail. # line 36, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ECHELON i.LON SmartServer 4.03-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.985s
[INFO] Finished at: Tue Jun 04 20:20:25 CEST 2013
[INFO] Final Memory: 4M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ilon-ws: Could not resolve dependencies for project com.echelon.es:ilon-ws:jar:4.03-SNAPSHOT: Failed to collect dependencies for [com.sun.xml.ws:jaxws-rt:jar:2.2 (compile)]: Failed to read artifact descriptor for woodstox:wstx-asl:jar:3.2.1: Could not transfer artifact woodstox:wstx-asl:pom:3.2.1 from/to java.net (http://download.java.net/maven/1/): No connector available to access repository java.net (http://download.java.net/maven/1/) of type legacy using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory -> [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....lutionException
I tried adding slf4j-nop-1.7.5.jar file to buildpath and nothing has changed.
Please give me any suggestions or help, becouse I can't handle it since last few days, and i don't know where to find answers.
Regards,
Kolata