I've been happily developing my API in AnypointStudio (Eclipse) 6.2.2 until just now I added a JSON-to-Object transformer to a flow; now when I build mvn clean package -U
I get:
Downloading: https://repository.mulesoft.org/nexus/content/repositories/public/org/mule/extensions/mule-extensions/3.8.3/mule-extensions-3.8.3.pom
[INFO] BUILD FAILURE
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 14.775 s
[INFO] Finished at: 2017-07-19T10:38:10+10:00
[INFO] Final Memory: 25M/644M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project foobar: Could not resolve dependencies for project org.foo:bar:mule:1.0.0-SNAPSHOT: Failed to collect dependencies at org.mule.modules:mule-module-json:jar:3.8.3 -> org.mule.modules:mule-module-validation:jar:3.8.3: Failed to read artifact descriptor for org.mule.modules:mule-module-validation:jar:3.8.3: Could not find artifact org.mule.extensions:mule-extensions:pom:3.8.3 in Central (http://central.maven.org/maven2/) -> [Help 1]
Can anyone suggest what's going wrong? Do I need an EE licence to use JSON-to-Object?
I found the answer to this. My POM was using Mule runtime 3.8.3
<mule.version>3.8.3</mule.version>
However, there is no release of the json module that corresponds to this release. The latest at Mulesoft Releases is 3.8.1:
https://repository.mulesoft.org/nexus/content/repositories/releases/org/mule/modules/mule-module-json/3.8.1/
So, manually changing the version of this dependency in my POM gets around the issue:
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-json</artifactId>
<version>3.8.1</version>
<scope>provided</scope>
</dependency>
Related
I've created a multi module Maven project in Intellij. The structure is the following
parent
|-module1
|
|-module2
|
|-module3
First I tried to build the parent module, everything was fine. But then I added a class in module2 and used it in module1. So I added a dependency in module1 pom.xml
<dependency>
<groupId>org.example</groupId>
<artifactId>module2</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
But when I try to build the parent (or the module1 as well)- I get the following
[INFO] Building 2 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.example:module2:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.188 s
[INFO] Finished at: 2021-12-02T23:29:35+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project module1: Could not resolve dependencies for project org.example:module1:jar:1.0-SNAPSHOT: Could not find artifact org.example:module2:jar:1.0-SNAPSHOT -> [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.
As I understand it tries to download the dependency from the central maven repository. I don't have any repository con1figurations at all.
I am running out of ideas what else to try.
Can you help to fix it?
This is most likely the ordering of your module builds - as specified in the parent POM. Module1 requires a class from module2, and that module (module2) is not yet built. Try swapping the ordering of module1 and module2 in the parent POM so that module2 is built before module1.
Maven is not able to download mysql connector 8.0.12 from central, showing the below error:
Downloading: https://repo.maven.apache.org/maven2/mysql/mysql-connector-
java/8.0.12/mysql-connector-java-8.0.12.pom
[INFO] ---------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
[INFO] Total time: 3.642 s
[INFO] Finished at: 2018-08-21T00:22:03+05:30
[INFO] Final Memory: 10M/113M
[INFO] ---------------------------------------------------------------------
[ERROR] Failed to execute goal on project OneSolution: Could not resolve
dependencies for project OneSolution:OneSolution:jar:1.1.1: Failed to
collect dependencies at mysql:mysql-connector-java:jar:8.0.12: Failed to
read artifact descriptor for mysql:mysql-connector-java:jar:8.0.12: Could
not transfer artifact mysql:mysql-connector-java:pom:8.0.12 from/to central
(https://repo.maven.apache.org/maven2): Received fatal alert:
protocol_version -> [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.
any help is appreciated, not getting enough suggestion online, trying here.
Solution 1: Try mvn clean install in console.
Solution 2: It might happen because of the firewall on your computer. Turn off the firewall and try it again.
Solution 3: Check if your pom.xml has similar dependency.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
If you are using intelliJ idea there is also an other option:
In the Maven tool window, click The Toggle Offline Mode button.
This will append the --offline option to all Maven commands that IntelliJ IDEA runs. It will also report any items that cannot be found in the local repository.
Or in Maven settings.xml:
<offline>false</offline>
Use this way in maven :
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
I have successfully installed a JAR into the Maven local repository. I edit my pom.xml to include these lines:
<dependency>
<groupId>org.jcrontab</groupId>
<artifactId>jcrontab</artifactId>
<version>4.0.0</version>
<scope>system</scope>
<systemPath>[somepath]/jcrontab-4.0.0.jar</systemPath>
</dependency>
But, after installing with install:install-file, I think these lines are redundant. I just use them to install and when I want to "use" the jar, they are useless because the jar is in the local repo.
So I changed them to:
<dependency>
<groupId>org.jcrontab</groupId>
<artifactId>jcrontab</artifactId>
<version>4.0.0</version>
</dependency>
The same form as those dependencies that exist in the remote Maven central repo. But now Eclipse complains about:
missing artifact: org.jcrontab:jcrontab:jar:4.0.0
And in the Maven dependencies library in Java Build path, I see red cross on the jar, saying:
jcrontab-4.0.0.jar - D:\desarrollo\eclipse-jee-mars-x86_64\eclipse\${maven.home}\m2\repository\org\jcrontab\jcrontab\4.0.0 (missing)
Under this dir, I only see:
jcrontab-4.0.0.jar.lastUpdated jcrontab-4.0.0.pom.lastUpdated
And no jar is there. But other dependencies jars in this Eclipse repo are in their places.
As I examine my maven home repo (<maven-installation-dir>/m2/repository), the jar is installed there. But in the repo under Eclipse dir, the jar is missing.
I am confused.
If the installation of external jar generates a JAR under Maven installation repo, why does Eclipse "Maven dependencies" library points to a repo under Eclipse dir? The {$maven.home} directory smells bad to me.
Am I supposed to change the dependencies of local installed jars like what I did?
As suggested, I execute the command of install:install-file, and I get:
C:\Windows\System32>mvn install:install-file -Dfile="D:\desarrollo\Java environment\lib\jcrontab-4.0.0.jar" -DgroupId=org.jcronta
b -DartifactId=jcrontab -Dversion=4.0.0 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # standalone-pom ---
[INFO] Installing D:\desarrollo\Java environment\lib\jcrontab-4.0.0.jar to D:\desarrollo\Java environment\lib\Maven\apache-maven-3.5.0\bin\..\m2\repository\org\jcrontab\jcrontab\4.0.0\jcrontab-4.0.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.597 s
[INFO] Finished at: 2017-08-03T14:27:48+02:00
[INFO] Final Memory: 6M/114M
[INFO] ------------------------------------------------------------------------
The same form as those dependencies that exist in the remote Maven central repo.
But jcrontab doesn't exist on maven central.
See yourself on maven central: https://search.maven.org/#search|ga|1|jcrontab
So you need to install the jar into your local repository if you want to use it like another dependency. You can do that like that:
mvn install:install-file -Dfile=jcrontab-4.0.0.jar -DgroupId=org.jcrontab -DartifactId=jcrontab -Dversion=4.0.0 -Dpackaging=jar
See also the maven documentation here: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
I'm trying to do a release of my OSS library, but I keep running in to a strange issue with the maven-release-plugin. This used to work fine. I've probably updated either Maven or Git but I can't seem to find the right combination to get things working again for the release.
Has anyone run into this issue, and does anyone know of a solution? I'm using the Maven Shade Plugin (which is what is creating the dependency-reduced-pom.xml files in the build.)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:27 min
[INFO] Finished at: 2015-11-04T08:23:07-05:00
[INFO] Final Memory: 111M/1039M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli) on project rewrite-parent: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] fatal: pathspec 'config-prettyfaces/dependency-reduced-pom.xml' did not match any files
[ERROR] -> [Help 1]
The dependency-reduced-pom.xml, as I understand it, is a temporary file used while merging dependencies into an uber-jar, and should not be committed, so I'm confused why maven is trying to add this file at all.
Thanks for any help.
I figured it out, at least a workaround:
Using 'checkModificationExcludes" configuration option of the maven-release-plugin to exclude the dependency-reduced-pom.xml seems to work around the issue, though I'm not sure this is exactly what the property was intended for (the documentation is unclear):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<checkModificationExcludes>
<checkModificationExclude>dependency-reduced-pom.xml</checkModificationExclude>
</checkModificationExcludes>
</configuration>
</plugin>
I have always gotten my dependencies from http://mvnrepository.com. Has worked every time. But I can't seem to get wss4j working. My POM is like this:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j</artifactId>
<version>2.1.3</version>
</dependency>
</dependencies>
I can get the Spring just fine, but I keep getting the "Can't find dependency" error. I even use the -U option and I get this:
Downloading: http://repo1.maven.org/maven2/org/org/apache/wss4j/wss4j/2.1.3/wss4j-2.1.3.jar
Downloading: https://repo.maven.apache.org/maven2/org/apache/wss4j/wss4j/2.1.3/wss4j-2.1.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.411s
[INFO] Finished at: Sat Oct 10 14:31:51 EDT 2015
[INFO] Final Memory: 9M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project crypt.lib: Could not resolve dependencies for project mmaceachran:crypt.lib:jar:0.0.1-SNAPSHOT: Could not find artifact org.apache.wss4j:wss4j:jar:2.1.3 in mvnrepository (http://repo1.maven.org/maven2/org/) -> [Help 1]
But there is is downloading!!! What am I doing wrong?
UPDATE:
I used the -e option and I see that it can't find the artifact:
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact org.apache.wss4j:wss4j:jar:2.1.3 in central (https://repo.maven.apache.org/maven2)
but it is clearly there: http://repo1.maven.org/maven2/org/apache/wss4j/wss4j/2.1.3/
Starting from WSS4J 2.x, the org.apache.wss4j/wss4j module is just used as part of the website generation. The dependency you probably want is org.apache.wss4j/wss4j-ws-security-dom.
Colm.
No, it isn't there: The artifact you declared in your pom has no <type>. i.e.: by default, Maven assumes a jar type. Look in URL you posted and realise there is no .jar artifact.
Surely you need to specify a type=pom.