Errors in eclipse for maven and alfresco sdk - java

I am working on a java maven project in eclipse using the m2e plugin. I configured maven plugin with eclipse but some problems occurred.
1.
Alfesco maven sdk link is not working in eclipse its not downloading the required Archetype which is alfresco- amp archtype.
I searched them alot bu I am new to maven and eclipse and, after a day of googling, I still haven't managed to find a solution for this.
Update
Maven Settings are given as follows is there any problem in maven settings. Is there any problem with local repository/catalog then how to change it?
Setttings.xml:
http://maven.apache.org/xsd/settings-1.1.0.xsd">
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>172.16.0.9</host>
<port>8080</port>
</proxy>
</proxies>
</settings>

Related

Maven configuration through proxy script

I need to develop applications here at the company. And inside the company's network there is a *.pac file that determine the destination according to the request.
I'm using git as the version control and maven as the dependency manager, after searching on the internet I've found the following link which helped me configure git to work properly:
Getting git to work with a proxy server
Unfortunately, for Maven I couldn't find a way to make it work.
I've checked the following links but none seemed to work either:
https://www.mkyong.com/maven/how-to-enable-proxy-setting-in-maven/
https://maven.apache.org/guides/mini/guide-proxies.html
Some comments were telling to configure the settings.xml file in the .m2 folder, I configured it like that:
<proxies>
<proxy>
<id>p1</id>
<active>true</active>
<protocol>http</protocol>
<host>hostname</host>
<port>3129</port>
<username>user</username>
<password>password</password>
</proxy>
<proxy>
<id>p2</id>
<active>true</active>
<protocol>https</protocol>
<host>hostname</host>
<port>3443</port>
<username>user</username>
<password>password</password>
</proxy>
</proxies>
Even so it doesn't work.
Has anyone went through this problem, does anyone know how to solve it?
Man, cut this id off and use only http, something like:
<proxy>
<!--<id>optional</id> -->
<active>true</active>
<protocol>http</protocol>
<username>user</username>
<password>passwrod</password>
<host>proxy address without "http://" </host>
<port>proxyport</port>
<nonProxyHosts>*.yourdomain.com</nonProxyHosts>
</proxy>
I put the file setting.xml with this configuration only in my .m2 folder and works like a charm to me.

Could not transfer artifact (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version -> [Help 1]

I am new to Maven and trying to setup my first project in Maven but receiving the below error message when I am doing " Run as -> Maven install " in Eclipse. Below is my settings.xml and pom.xml
Settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\Users\Iam\.m2\repository</localRepository>
<profiles>
<profile>
<repositories>
<repository>
<id>central</id>
<url>http://central.maven.org/maven2/</url>
</repository>
</repositories>
<pluginRepositories>
</pluginRepositories>
</profile>
</profiles>
</settings>
POM.XML
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mytest</groupId>
<artifactId>MySpringBootMaven</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.11.RELEASE</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version><!--$NO-MVN-MAN-VER$-->
<configuration>
<warnName>Test.war</warnName>
</configuration>
</plugin>
</plugins>
</build>
</project>
Error message:
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.springframework.boot:spring-boot-maven-plugin:jar:1.5.11.RELEASE
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:218)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:103)
... 27 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.11.RELEASE from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:287)
... 30 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.11.RELEASE from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version
How to resolve the Received fatal alert: protocol_version ? My java version is 1.7 and maven version is 3.3.3
Sonatype no longer supports TLSv1.1 and below (effective, June 18th, 2018). My guess is that you are using TLSv1.1 protocol or below.
The documentation I listed gives you 4 options:
Upgrade your Java runtime, for example with OpenJDK builds or Oracle paying support
Configure your Java runtime to enable TLS 1.2 by adding -Dhttps.protocols=TLSv1.2
Use a repository manager that uses a Java version supporting TLS 1.2
Revert back to http until you can acheive one of the above remediation steps.
I fixed it myself by just using -Dhttps.protocols=TLSv1.2 as a VM argument.
 
For a permanent solution(mostly required in Java 7) - in you build directory(where you do the mvn command from) add directory:
.mvn (in cmd mkdir .mvn)
and in it create file
jvm.config
and in put the following line:
-Dhttps.protocols=TLSv1.2
The simplest solution is to configure your JVM runtime arguments. On eclipse, you can do it as following :
go to windows>preferences>java>installed JREs
click on the Intalled JRE/JDK you are using for your project
click on "edit" on le right,
and add -Dhttps.protocols=TLSv1.2 in the Default VM arguments Input field.
see the screenshot :
The Package you are trying to install doesn't support TLS1.1 and you might be by default using TLS 1.1. Configure your Java runtime to enable TLS 1.2 by adding -Dhttps.protocols=TLSv1.2 to your Maven Build command would solve the problem.
For Example: mvn clean install -Dhttps.protocols=TLSv1.2
I had upgraded from Java 1.7 to Java 1.8 and got the same error.
To resolve this error, I checked the mvn version using mvn -version and found that JAVA_HOME was still using the Java 1.7. I changed the JAVA_HOME in the environment variable to point to Java 1.8 jre in JDK
Hope this helps someone.
I set my settings.xml file in the .m2 directory just as the one here: https://github.com/alipay/sofa-rpc/pull/190/files
Then exec mvn install and all dependencies started to download. I haven't had a settings.xml file before and I am not using any proxy.
Hope it helps somebody.
PD. I have jdk 1.7 and Maven 3.3.9
I resolved this error in SpringToolSuit by adding settings.xml file in .m2 folder which is located in Users folder of C drive and by updating Project by
right click on pom.xml -> Maeven -> Update Project.
Make sure you select Force update of snapshots/releases.
It needs both : Configuring the JVM runtime arguments as well as having a settings.xml, after I did both it worked. Updating only the JVM runtime argument did not help.
In my case the automatic update of maven dependencies were disabled in eclipse.
Solution:
Go to
Windows->Preferences->Maven
and uncheck the check box
"Do not automatically update dependencies from remote repositories"
Then update the project
Right click on project->maven->update project
I had the same issue, I tried most of the answers here but still did not work. My issue was Proxy settings on my IDE. So it is also important to remember to check proxy settings. File > Settings > System Settings > HTTP Proxy - Select Auto-Detect proxy settings
On my new laptop (Win10) I have downgraded maven 3.8.7->3.6.3 and jdk 19->1.8
Maven 3.8.7 is blocking a lot of old repositories, one sometimes does need.

deploying an artifact whit pom into a given repo in command line? (without pom edition and file-deploy)

I have auto-generated java code I want to deploy in our maven repo. The generated code has a pom.xml without the repo info. I what to know if I can deploy the complete maven project in my repo without touching the pom. And by complete maven project, I mean not only the final jar using the file-deploy maven command.
The repo has security enabled and requires usr/pass
I found a way. You need to add the server to the settings file as following:
<servers>
<server>
<id>my-server</id>
<username>user</username>
<password>pass</password>
</server>
</servers>
then I deploy using the following maven command (replacing <url> for the target repo):
mvn deploy -D"altDeploymentRepository=my-server::default::<url>"

Maven project error in eclipse Java EE

I Created a Maven project following this tutorial, and it worked properly. Now when I create a Maven project again, it gives the following error.
Could anyone help me to solve this issue?
I found same error and resolved using this question of StackOverflow
solution-1 (please follow this link for further assistance)
By following below steps
Open Window > Preferences
Open Maven > Archetypes
Click 'Add Remote Catalog' and add the
following:
Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml
Description: maven catalog
Maven > User Setting > c:\Users\xxxxxxxx.m2\settings.xml
If you are a proxy, you need this configuration:
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
| -->
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>******</username>
<password>*******</password>
<host>*****proxy_host*****</host>
<port>8080</port>
</proxy>
</proxies>

Robolectric unable to get resource

When I'm trying to use Robolectric I got following errors (I can't paste more, because I'm new here). How can I solve it?
Downloading: org/robolectric/android-all/4.3_r2-robolectric-0/android-all-4.3_r2-robolectric-0.pom from repository central at
http://repo1.maven.org/maven2
[WARNING] Unable to get resource 'org.robolectric:android-all:pom:4.3_r2-robolectric-0' from repository sonatype
https://oss.sonatype.org/content/groups/public/
Error transferring file: Connection refused: connect
UPDATE:
I solved my problem. Using proxy caused that.
You should write correct proxy settings for maven.
Create settings.xml file in your ~/.m2 directory
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host></host>
<port></port>
<username></username>
<password></password>
</proxy>
</proxies>
</settings>
You can read additional info here https://maven.apache.org/guides/mini/guide-proxies.html

Categories