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.
Related
if I run my java maven project from Eclipse I don't habe problems. All encodings are UFT-8, but if I compile with
maven clean package
I have problems with the encoding on some different places. XSLT-transform, SOAP and so on.
I found some tricks in the Internet, but nothing helps. What can I do?
Things I tested with no effect:
pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
</configuration>
</plugin>
On console:
mvn -DargLine=-Dfile.encoding=UTF-8 clean package
$ mvn --version
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: C:\Program Files\apache-maven-3.5.3
Java version: 1.8.0_201, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_201\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
The Platform encoding is CP1252.
How can I say maven to use UTF-8, Eclipse can do it.
Thanks for any help.
UPDATE:
I enabled the DEBUG output from Eclipse, there are this lines:
Maven home: C:\Users\EMBEDDED
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_201\jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
platform encoding: UTF-8 <- How can I do this
UPDATE 2:
Setting Systemvariable JAVA_TOOL_OPTIONS to -Dfile.encoding=UTF-8 helps. Now it works.
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.
I'm trying to use Takari SmartBuilder in a Maven project under Jenkins.
After testing it locally everything was working perfectly, but in Jenkins the Takari extension is not loaded.
After some investigation I found that maven's "-B" option order was preventing the projects extensions to load.
Not loading extensions:
mvn -B -f <project-name>/pom.xml clean install -X
Loading extensions:
mvn -f <project-name>/pom.xml -B clean install -X
Extensions are set in the root project folder under .mvn/extensions.xml
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>io.takari.maven</groupId>
<artifactId>takari-smart-builder</artifactId>
<version>0.4.0</version>
</extension>
<extension>
<groupId>io.takari.aether</groupId>
<artifactId>takari-concurrent-localrepo</artifactId>
<version>0.0.7</version>
</extension>
<extension>
<groupId>io.takari.aether</groupId>
<artifactId>aether-connector-okhttp</artifactId>
<version>1.0.1-alpha</version>
</extension>
</extensions>
Versions:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /opt/maven-versions/apache-maven-3.3.9
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /opt/java-versions/jdk1.7.0_65/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-327.13.1.el7.x86_64", arch: "amd64", family: "unix"
I believe I am facing a similar issue.
see https://issues.jenkins.io/browse/JENKINS-70357
It seems that the Jenkins Maven Integration Plugin is injecting the -B parameter unconditionally and for a good reason I am afraid.
However, either with or without interactive mode enabled, the extensions are loaded successfully (from lib/ext though), which proves that interactive mode does not control extensions in any way.
Also, using MavenJob offers some substantial advantages, like triggering downstream builds etc., which cannot be used with FreeStyleJob, making use of MavenJob necessary for certain development environments.
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.
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)