I am getting the following Error in Maven
Project build error: Unresolveable build extension: Plugin org.mule.tools.maven:mule-app-maven-plugin:1.1 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:
1.5.0 at specified path C:\Program Files\Java\jre7/../lib/tools.jar
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<groupId>com.jaggedpeak</groupId>
<artifactId>amazon-integration</artifactId>
<version>1.0.0</version>
<packaging>mule</packaging>
<name>Mule amazon-integration Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8
</project.reporting.outputEncoding>
<mule.version>3.7.0</mule.version>
<mule.tools.version>1.1</mule.tools.version>
<munit.version>1.1.0</munit.version>
<mule.munit.support.version>3.7.1</mule.munit.support.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
<inclusions>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-extensions-support</artifactId>
</inclusion>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-extensions-spring-support</artifactId>
</inclusion>
</inclusions>
</configuration>
</plugin>
<plugins>
</build>
Note:
The following are my findings ,My build is pointing to JDK,There is no restriction in downloading.
point your project to jdk instead of jre.
Related
This is the first time I have tried to make a minecraft plugin, and I get this error:
I am not a programmer, so can some one say why I had this error when I go in build.xml?
Eclipse version : 4.20.0
build.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>test.plugin.test</groupId>
<artifactId>test</artifactId>
<version>1.0-Complete</version>
<packaging>jar</packaging>
<name>main test</name>
<description>test</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</project>
The error message suggests that the software reading the file is expecting Ant stuff but found something else, which it could not interpret. Indeed build.xml is a typical name for a build file used by Ant, but the contents shown appear to be meant to be saved as a pom.xml file to be used by Maven. A good first step might be to correct the filename; perhaps then the program would read it in the right frame of mind.
I am using maven project for UI automation and I need to run some tests in multiple environment and multiple browsers.
I have created added the pom.xml file and declared the properties in it. But when i execute it through the terminal i get errors.
command i used-
mvn clean
mvn test -Denvironment=test -Dbrowser=chrome
My Xml file-
<?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>org.example</groupId>
<artifactId>ui-automation-projects</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<property>
<environment>${environment}</environment>
</property>
<property>
<browser>${browser}</browser>>
</property>
</properties>
<dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
</plugin>
</plugins>
</build>
Error-
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM D:\work\Cucumber_Projects\ui-automation-projects\pom.xml: TEXT must be immediately followed by END_TAG and not START_TAG (position: START_TAG seen ...\n ... #13:26) # line
13, column 26
You must delete <property> and add your property under <properties>.
<properties>
<environment>${environment}</environment>
<browser>${browser}</browser>
</properties>
Also, you have an extra '>' after </browser>
Project properties in pom.xml are declared like this:
<properties>
<environment>default-environemnt-value</environment>
<browser>default-browser-value</browser>>
</properties>
You can read more in POM reference
You have error during the parson pom.xml file I checked it into my Idea and corrected. You didn't have </project> tag and <dependencies> </dependencies> were redundant. Also there should be answer
<properties>
<environment>${envValue}</environment>
<browser>${browserValue}</browser>
</properties>
After this the file builds correctly.
<?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>org.example</groupId>
<artifactId>ui-automation-projects</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<environment>${envValue}</environment>
<browser>${browserValue}</browser>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
</plugin>
</plugins>
</build>
</project>
I have seen u r POM couple of ties and have seen my local pom how I have defined my dependencies and POM
I found 2 things
You have defined the properties already in which u can directly add the value
(Here in your case it is environment and Browser)
else define alone as follows in properties
${environment}
I haven't seen end for the Project in the POM.
Try adding that and that should work.
enter image description here
I am trying to migrate my application from Java 8 to Java 11. In of one of my project classes, I have the line Security.addProvider(new com.sun.crypto.provider.SunJCE());. I am getting a compile error for this line. How to resolve this?
You can't access com.sun packages without explicitly setting them on your compile options. After adding --add-exports=java.base/com.sun.crypto.provider=ALL-UNNAMED to compilerArgs it compiles without any error.
Code:
Security.addProvider(new com.sun.crypto.provider.SunJCE());
Maven:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<properties>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArgs>
<arg>--add-exports=java.base/com.sun.crypto.provider=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
java.security.Security.getProviders() returns you all the providers including the SunJCE.
Stream.of(java.security.Security.getProviders()).forEach(System.out::println);
So better option to get the SunJCE instane is java.security.Security.getProvider("SunJCE")
When i was writing my first "real" java project (a todo app in console), I realised i use a lot of methods that could be easily made into my very own library (simple Maven project). I added the root folder to my main procejt with File>Project Structure>Modules>Dependencies>Java and selected the root folder - Toolbox. But when i type
import org.toolbox.Tools.*;
it is all good and the usages are fine but it fails to compile.
First the error message:
Error:(5, 19) java: package org.toolbox does not exist
Error:(6, 25) java: package org.toolbox.Tools does not exist
Error:(10, 69) java: package Tools does not exist
Error:(13, 9) java: cannot find symbol
symbol: class Tools
location: class org.todo.ToDo
Error:(13, 27) java: cannot find symbol
symbol: class Tools
location: class org.todo.ToDo
Error:(16, 9) java: cannot find symbol
symbol: class STATE
location: class org.todo.ToDo
Error:(18, 23) java: cannot find symbol
symbol: variable STATE
location: class org.todo.ToDo
Now a screenshot of my dependencies
IntelliJ Idea Ultimate 2019.3.1
JDK 11.0.1
Manjaro Linux
Any help would be greatly appreciated
As requested, the pom.xml of todo:
<?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>org.todo</groupId>
<artifactId>TO-DO</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
</project>
and the pom.xml of my library:
<?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>org.toolbox</groupId>
<artifactId>Toolbox</artifactId>
<version>1.0-SNAPSHOT</version>
// because i was getting an error with maven compiler defaulting to 1.5
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
</project>
Make the library project too a maven project (with it's own group, artifact id and version).
Than add to the dependancy of other maven projects.
(This would wourk both inside and outside the IDE)
Once you start with maven, keep going with maven, try to add dependancies :
You must install the dependancy with maven (either from command line or from the IDE) running 'mvn clean install' (this is basic for packaging system like maven).
<?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>org.todo</groupId>
<artifactId>TO-DO</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- try to add dependancies -->
<dependencies>
<dependency>
<groupId>org.toolbox</groupId>
<artifactId>Toolbox</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
I've 1 project with one subproject in my teamcity server. The subproject has the pom.xml file that references parent project.
This is the pom.xml of the project:
<?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>it.company.project</groupId>
<artifactId>MyProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>MyProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>Foo</module>
</modules>
</project>
This is the pom.xml of the subproject:
<?xml version="1.0"?>
<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>
<parent>
<groupId>it.company.project</groupId>
<artifactId>MyProject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>Foo</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>subproject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</resource>
</resources>
</build>
</project>
When I run the maven build from my IDE (IntelliJ IDEA) on my subproject, all works fine. Also when I run maven build on the parent project all works fine.
When I run build agent (configured to run pom.xml) from TeamCity server on my subproject it doesn't work, and I've the following errors:
[Step 1/1] Error reading Maven project: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Could not find artifact it.company.project:MyProject:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM # line 5, column 13
.
[14:08:12][Step 1/1] TeamCity is unable to read Maven project. Some features may be unavailable
When I run build agent (configured to run pom.xml) from TeamCity server on my parent project it doesn't work, and I've the following errors:
An error occurred during collecting Maven project information: File not found in any VCS root: subproject/pom.xml.
My subproject build configurations:
What's wrong?
Thanks