Maven Configuration Probleme with ECLIPSE Kepler - java

I tried to follow a tutorial but, I got an error with maven right from the first step.
Failure to transfer org.codehaus.plexus:plexus-archiver:pom:1.2 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will
not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-
archiver:pom:1.2 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/org/codehaus/
plexus/plexus-archiver/1.2/plexus-archiver-1.2.pom
My pom.xml is as follow:
<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.dictionnaire.allemand</groupId>
<artifactId>translator</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>translator Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
<build>
<finalName>translator</finalName>
</build>
</project>
i tried many sollutions like
mvn -U install
but without success. have you any idea how can i fix this error? im working with eclipse-Kepler for java EE devlopper. and i don't working behind a proxy or a firewall.
here is the content of http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/1.2/plexus-archiver-1.2.pom
<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>
<artifactId>plexus-components</artifactId>
<groupId>org.codehaus.plexus</groupId>
<version>1.1.18</version>
</parent>
<artifactId>plexus-archiver</artifactId>
<version>1.2</version>
<name>Plexus Archiver Component</name>
<scm>
<connection>
scm:svn:http://svn.codehaus.org/plexus/plexus-components/tags/plexus- archiver-1.2
</connection>
<developerConnection>
scm:svn:https://svn.codehaus.org/plexus/plexus-components/tags/plexus- archiver-1.2
</developerConnection>
<url>
http://fisheye.codehaus.org/browse/plexus/plexus- components/tags/plexus-archiver-1.2
</url>
</scm>
<properties>
<useJvmChmod>false</useJvmChmod>
</properties>
<contributors>
<contributor>
<name>Dan Tran</name>
</contributor>
<contributor>
<name>Richard van der Hoff</name>
</contributor>
</contributors>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-io</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<systemPropertyVariables>
<useJvmChmod>${useJvmChmod}</useJvmChmod>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>

Related

Submodule can't find parent module as dependency in maven

I have a Maven project with a JavaFX submodule and it just started giving me an error, I can't find any changes I made to the submodule that might've caused this other than starting a git repository. I think something is wrong with the <build> in the submodule pom, but nothing I tried worked. The submodule pom is mostly generated by IntelliJ.
Parent pom:
<?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>ChoreSystem</artifactId>
<packaging>pom</packaging>
<version>1.0.1</version>
<modules>
<module>ChoreServer</module>
<module>User</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
...
</dependencies>
</project>
Submodule pom:
<?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">
<parent>
<artifactId>ChoreSystem</artifactId>
<groupId>org.example</groupId>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>User</artifactId>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17-ea+11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17-ea+11</version>
</dependency>
<dependency>
<groupId>org.example</groupId>
<artifactId>ChoreSystem</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>AppLauncher</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
When I run the User with ```clean javafx:run```
I get this Error:
[ERROR] Failed to execute goal on project User: Could not resolve dependencies for project org.example:User:pom:1.0.1: Failure to find org.example:ChoreSystem:jar:1.0.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
Not clear why submodule User should declare a dependency on the parent pom ChoreSystem which looks like it is there just to run a sequence of child modules. Maybe you meant to declare a dependency on ChoreServer.

when I run java Maven Project from cmd I get MojoExecutionException

I have problem by running Maven-Project from command_line
I used this command in cmd to run class named mainClass
mvn -e exec:java -Dexec.mainClass="com.example.Main"
and here is what I have in my pom file:
<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>Linux</groupId>
<artifactId>Linux</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.37.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<!-- Needs to be the same version that REST Assured depends on -->
<version>2.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
</dependencies>
</project>
I get Mojo Exception caused by class not found exception, but actually I don't know where I should provide the name or the path to the class I want to run
this is the response of the command in command-line
I have modified your Maven pom.xml and added Maven mojo plugin. You can find below the code.
First you have to build project and then you can execute the Main java class.
Here, follow the steps.
Go to command prompt and go to the project/directory containing pom.xml.
Type the command mvnw clean package. I have used maven wrapper.
Then type command mvnw exec:java -Dexec.mainClass="com.so.help.maven.Main"
You can find the sample project in github.
<?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>execute-java-maven</groupId>
<artifactId>execute-java-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<name>execute-java-maven</name>
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.37.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<!-- Needs to be the same version that REST Assured depends on -->
<version>2.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>com.so.help.maven.Main</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

maven module referencing itself during install command

When I run maven install I get following message -
Failed to execute goal on project Ret: Could not resolve dependencies
for project com.software.org:Ret:jar:1.0-SNAPSHOT: Could not find
artifact com.software.org:Ret:jar:1.0
Here's my pom.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>com.software.nagibator</groupId>
<artifactId>Ret</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<compiler>1.8</compiler>
</properties>
<dependencies>
<dependency>
<groupId>com.nag.software</groupId>
<artifactId>SpringContainer</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.187</version>
</dependency>
<dependency>
<groupId>com.software</groupId>
<artifactId>nag</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.software.org</groupId>
<artifactId>SpringProxyProvider</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${compiler}</source>
<target>${compiler}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>

maven pom.xml file wont recognize jersey framework

I am trying to import jersey using maven central but, intellij wont read my pom.xml dependency for jersey. The version # shows in red with the following error:
here is the pom.xml textually:
<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.example.emanuel</groupId>
<artifactId>jerseyexample</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>jerseyexample Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.19</version>
</dependency>
</dependencies>
<build>
<finalName>jerseyexample</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>TomcatServer</server>
<path>/newjersey</path>
</configuration>
</plugin>
</plugins>
</build>
</project>
i copied the dependency straight from here
the issue was with my settings.xml file that maven uses to build the project. I had a mirror defined in there that used a proxy and it was blocking the download.

Maven cycle dependency

I'm new to Maven and Im trying to make my own Java EE Maven project with some frameworks...
I have started with two modules and one parent module.
The problem is that Im getting this error when Im issue mvn clean:
[ERROR] The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='org.tepo:Jporto-web:0.0.1-SNAPSHOT'}' and 'Vertex{label='org.tepo:Jporto-ejb:0.0.1-SNAPSHOT'}' introduces to cycle in the graph org.tepo:Jporto-ejb:0.0.1-SNAPSHOT --> org.tepo:Jporto-web:0.0.1-SNAPSHOT --> org.tepo:Jporto-ejb:0.0.1-SNAPSHOT -> [Help 1]
I know what cycle dependency is, but I can not see such a thing in my poms. Here They are:
parent POM:
<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.tepo</groupId>
<artifactId>Jporto</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>jsf library tutto</name>
<description>fiesta prego grande</description>
<dependencies>
<dependency>
<groupId>org.tepo</groupId>
<artifactId>Jporto-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.tepo</groupId>
<artifactId>Jporto-web</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
<scope>compile</scope>
</dependency>
</dependencies>
<modules>
<module>Jporto-ejb</module>
<module>Jporto-web</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<version>2.5.1</version>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<ejbVersion>3.1</ejbVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
WEB module:
<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>
<artifactId>Jporto</artifactId>
<groupId>org.tepo</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>Jporto-web</artifactId>
<groupId>org.tepo</groupId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
EJB module:
<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>
<artifactId>Jporto</artifactId>
<groupId>org.tepo</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>org.tepo</groupId>
<artifactId>Jporto-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ejb</packaging>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ejb3</artifactId>
<version>7.1.0.CR1b</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Please, can ypu explain to me why Im getting this error ?
also, eclipse gives this error on pom file of web module: Missing artifact org.tepo:Jporto-web:war:0.0.1-SNAPSHOT:compile
and
Missing artifact org.tepo:Jporto-ejb:ejb:0.0.1-SNAPSHOT:compile on web module...
Thank you for your help!
Your parent pom depends on your modules which depend on your parent pom.
What you could have done is add to your parent pom
<modules>
<module>module1</module>
<module>module2</module>
</module>
Your modules have to be subdirectories with the names you give them.

Categories