I am unable to build the project using apache-maven3.2.2 - java

I am unable to build the project using Apache-maven 3.2.2 and As i am new to the maven i am not able to find the issue. Please provide some solutions to resolve it.
And the error as follows:
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR] Unresolveable build extension: Plugin
org.apache.maven.wagon:wagon-ftp:1.0-beta-2 or one of its dependencies could
not be resolved: Failed to read artifact descriptor for
org.apache.maven.wagon:wagon-ftp:jar:1.0-beta-2: Could not transfer artifact
org.apache.maven.wagon:wagon-ftp:pom:1.0-beta-2 from/to central
(http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host
repo.maven.apache.org -> [Help 2]
and my maven version as follows:
C:\Users\xyz>mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T19:21:42+05:30)
Maven home: D:\software\Maven\apache-maven-3.2.2-bin\apache-maven-3.2.2
Java version: 1.7.0_01, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.7.0_01\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows nt (unknown)", version: "6.2", arch: "x86", family: "windows"

The problem is with your maven path , you have to give bin as your maven path

In your pom.xml, try to find this dependency.
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-beta-2</version>
</dependency>
and you can change it with the following artifact;
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>2.10</version>
</dependency>
if it does not work, the problem is with your internet settings, as Tunaki said.

Related

How can I make maven-metadata.xml have the same timestamp as the artifact wen deployed with maven?

I have a Nexus 3 which I deploy some artifacts from Jenkins with "mvn deploy". I have A LOT of modules 500+. The build looks kind of like this:
mvn clean package -DskipTests -DskipITs -T C1
mvn install -DskipTests -DskipITs -T C1
mvn deploy --quiet -DskipTests -DskipITs -Dmaven.validate.skip=true -Dmaven.compile.skip=true -Dmaven.test.skip=true -Dmaven.package.skip=true -Dmaven.integration-test.skip=true -Dmaven.verify.skip=true -T C1
The problem is that from time to time my artifacts have a timestamp while the metadata has a different timestamp. 1 second difference usually.
This is what I see in nexus at https://mynexus.com/repository/snapshots/com/company/my-artifact/1.0.0-SNAPSHOT/maven-metadata.xml
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>com.company</groupId>
<artifactId>my-artifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
<versioning>
<snapshot>
<timestamp>20170613.140447</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20170613140447</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<extension>war</extension>
<value>1.0.0-20170613.140447-1</value>
<updated>20170613140447</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>1.0.0-20170613.140447-1</value>
<updated>20170613140447</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
Judging the maven-metadata.xml, the artifact URL should be this:
https://mynexus.com/repository/snapshots/com/company/my-artifact/1.0.0-SNAPSHOT/my-artifact/1.0.0-20170613.140447-1.war
But it is not. Instead, the artifact is at this location:
https://mynexus.com/repository/snapshots/com/company/my-artifact/1.0.0-SNAPSHOT/my-artifact/1.0.0-20170613.140446-1.war
mvn --version
OpenJDK 64-Bit Server VM
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: /usr/local/apache-maven
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-64-generic", arch: "amd64", family: "unix"
The version of maven-deploy-plugin is 2.8.2
What am I doing wrong? How can I fix this?
Thank you!
This is a bug in Maven 3.5.0 and and will be resolved whenever 3.5.1 is released.
The original bug-report targed the deploy-plugin (https://issues.apache.org/jira/browse/MDEPLOY-221) however it's an issue with maven core: https://issues.apache.org/jira/browse/MNG-6240.
We hit the same issue at my work and after some digging and searching on mavens issue tracker I found the above links. I would suggest downgrading while waiting for 3.5.1 to come out.

LogicalDoc build error?

I tried to build LogicalDoc 6.7.1 with JDK 1.7, maven 3.0.3 and Ant 1.7
but it does not work and get these error , please help?
D:\maqtary\logicaldoc-6.7.1-src\build\poms>mvn -version
Apache Maven 3.0.3 (r1075438; 2011-02-28 09:31:09-0800)
Maven home: C:\Users\PC\Downloads\apache-maven-3.0.3
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_80\jre
Default locale: en_US, platform encoding: Cp1256
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
D:\maqtary\logicaldoc-6.7.1-src\build\poms>mvn install
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.logicaldoc:logicaldoc-parent-pom:62
(D:\maqtary\logicaldoc-6.7.1-src\build\poms\pom.xml) has 1 error
[ERROR] Unresolveable build extension: Error resolving version for plugin
'org.apache.maven.wagon:wagon-ssh' from the repositories [local
(C:\Users\PC\.m2\repository), central (http://repo1.maven.
org/maven2)]: Plugin not found in any plugin repository -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2]
http://cwiki.apache.org/confluence/display/MAVEN/PluginVersionResolutionException
D:\maqtary\logicaldoc-6.7.1-src\build\poms>
</code></pre>
As the error message states, your maven build is failing because something in D:\maqtary\logicaldoc-6.7.1-src\build\poms\pom.xml is telling it to use the maven plugin org.apache.maven.wagon:wagon-ssh, which doesn't exist in maven central repository, or your local repository, and thus the build fails.
It looks like said plugin can be found here

Maven error with maven-clean-plugin

I'm new to maven and i'm trying to use the following command :
mvn clean install -DskipTests=true
but i get the following error :
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:3.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:3.0.0: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:3.0.0 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -> [Help 1]
I have absolutly no idea of what i'm missing. Here is my pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.sf.okapi</groupId>
<artifactId>build-okapi-superpom</artifactId>
<version>0.30-SNAPSHOT</version>
<relativePath>superpom/pom.xml</relativePath>
</parent>
<artifactId>build-okapi-root</artifactId>
<packaging>pom</packaging>
<name>Okapi Build Root</name>
<url>https://bitbucket.org/okapiframework/okapi</url>
<modules>
<module>superpom</module>
<module>okapi</module>
<module>okapi-ui/swt</module>
<module>applications</module>
</modules>
</project>
My maven version :
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /root/apache-maven-3.3.9
Java version: 1.7.0_101, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.14.32-xxxx-grs-ipv6-64", arch: "amd64", family: "unix"

create maven project failed

I create a simple maven project in eclipse(indigo), it reports an error:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3
I found maven-resources-plugin:2.5 in local repo.
I don't understand why my project needs 2.4.3 but not 2.5?
mvn -v:
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: D:\Program Files\maven-3.0
Java version: 1.6.0_31, vendor: Sun Microsystems Inc.
Java home: D:\Program Files\Java\jdk1.6.0_31\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"
I solved it,
just create src/main/java, src/main/resources, src/test/java, src/test/resources
The maven-resources-plugin will disappear.

Maven doesnt use specified source and target settings

I'm trying to build a java project using maven. In the pom.xml file at the root of the project I have the following lines:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<debug>true</debug>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
but when I try to build with mvn -DskipTests -U install, I get the following error: static import declarations are not supported in -source 1.3
maven is not using the source and target (1.6) that i've specified in the pom.
java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
mvn --version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_11, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.5.0-21-generic", arch: "amd64", family: "unix"
uname -a
Linux ubuntu 3.5.0-21-generic #32-Ubuntu SMP Tue Dec 11 18:51:59 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Is there anywhere else that maven might be getting its default source and target settings from? Why isnt it using the settings from the pom?
Here is a snippet of error message when maven is ran in debug mode:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project LeaderLines: Compilation failure
[ERROR] /path/geoserver-2.2/geotools-plugin/LeaderLines/src/org/geotools/filter/function/FilterFunction_leaderLine.java:[22,7] error: static import declarations are not supported in -source 1.3
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins: maven-compiler-plugin:2.0.2:compile (default-compile) on project LeaderLines: Compilation failure
/path/geoserver-2.2/geotools-plugin/LeaderLines/src/org/geotools/filter/function/FilterFunction_leaderLine.java:[22,7] error: static import declarations are not supported in -source 1.3
Try setting the source level and source encoding with the following properties:
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Try to clear you local Maven repo and run your build again (maybe, try also to run it with '-o' option)

Categories

Resources