apache archiva doesn't load plugin from central repo - java

I want to use Apache Archiva like a company repo and mirror of the central maven repo(https://repo.maven.apache.org/maven2).
But archiva can't download jar from central repo, when I call archiva's server.
Somebody knowns how to fix it?
Result of compile my project is:
[INFO] Scanning for projects...
Downloading: http://localhost:8080/org/apache/maven/wagon/wagon-ssh/1.0-beta-7/wagon-ssh-1.0-beta-7.pom
[WARNING] The POM for org.apache.maven.wagon:wagon-ssh:jar:1.0-beta-7 is missing, no dependency information available
Downloading: http://localhost:8080/org/apache/maven/wagon/wagon-ssh/1.0-beta-7/wagon-ssh-1.0-beta-7.jar
Downloading: http://localhost:8080/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR] The project MyProject:2.05:1.0 (d:\Work\test_maven\pom.xml) has 1 error
[ERROR] Unresolveable build extension: Plugin org.apache.maven.wagon:wagon-ssh:1.0-beta-7 or one of its dependencies
could not be resolved: The following artifacts could not be resolved: org.apache.maven.wagon:wagon-ssh:jar:1.0-beta-7,
org.codehaus.plexus:plexus-utils:jar:1.1: Could not find artifact org.apache.maven.wagon:wagon-ssh:jar:1.0-beta-7
in internal (http://localhost:8080/) -> [Help2]
I use default archiva settings for repositories and proxyConnectors (have connector from internal to central repo. I don't use a proxy for Internet).
Central repo "remote check" is correct.
My maven settings.xml:
<mirror>
<id>internal</id>
<name>Archiva Internal Repository</name>
<url>http://localhost:8080/</url>
<mirrorOf>*</mirrorOf>
</mirror>
My pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<name>Maven Default Project</name>
<groupId>MyProject</groupId>
<artifactId>2.05</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>own</groupId>
<artifactId>imapown</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<sourceDirectory>src</sourceDirectory>
</build>
</project>
Version jdk: 1.6.0_45, maven: 3.2.5, archiva: 2.2.1

Related

Why java pacakges are not loading in intelliJ ideda

I followed a tutorial and get this dependency file in maven project in intelliJ IDEA 2018.3
My 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>kafka.sample.firstProject</groupId>
<artifactId>kafka-first-sample</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<kafka.version>2.1.0</kafka.version>
</properties>
<build>
<plug
ins>
<!-- Maven Compiler Plugin-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Apache Kafka Clients-->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.0.0</version>
</dependency>
<!-- Apache Kafka Streams-->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
<version>2.0.0</version>
</dependency>
<!-- Apache Log4J2 binding for SLF4J -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.11.0</version>
</dependency>
<!-- JUnit5 Jupiter -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<!-- JUnit 5 Jupiter Engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<!-- JUnit 5 Jupiter Parameterized Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
but whenever i try to run my build it throws this:
Error:(3, 41) java: package org.apache.kafka.clients.producer does not
exist and so on ...
Even after trying to run maven build still the problem persist.
Believe it or not i have get stuck in this problem from last many days.
Edit:
As #Parsecer asked to show maven build log, i found that there is an error as well
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building kafka-first-sample 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.329 s
[INFO] Finished at: 2019-02-20T09:10:30+05:00
[INFO] Final Memory: 7M/34M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): No such host is known (repo.maven.apache.org) -> [Help 1]
[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/PluginResolutionException
Process finished with exit code 1
1) Check settings of IntelliJ by Ctrl-Alt-S. Type 'Maven' and see if you have proper Maven distribution (not the bundled one).
2) Refresh your Maven project from the right hand side of IntelliJ window.
This happens due to several issues which normally fixed after an IDE restart. Well you can try several things,
Do a maven reimport
Do a maven Download sources and documentation
And restart the JIdea IDE
You can try to use a latest maven version and see also.
My System was behind a Proxy which not allowing me to get these packages. I remove the proxy and now it is working fine.

Mule - Project build failed when running with maven

I'm getting a failure trying to run a Hello World Mulesoft project, it looks like it related to the version of Mulesoft that I'm running, I googled around but I couldn't get any info to help resolve this issue, here is the build error:
[10:01:21] Running: mvn clean package -DskipMunitTests
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Mule firsttest Application 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.mulesoft.muleesb:mule-core-ee:jar:3.8.4 is missing, no dependency information available
[WARNING] The POM for com.mulesoft.muleesb.modules:mule-module-spring-config-ee:jar:3.8.4 is missing, no dependency information available
[WARNING] The POM for com.mulesoft.muleesb.transports:mule-transport-jdbc-ee:jar:3.8.4 is missing, no dependency information available
[WARNING] The POM for com.mulesoft.muleesb.transports:mule-transport-jms-ee:jar:3.8.4 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.496 s
[INFO] Finished at: 2017-08-31T10:01:27-05:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "compiler" could not be activated because it does not exist.
[ERROR] Failed to execute goal on project firsttest: Could not resolve dependencies for project com.schwab:firsttest:mule:1.0.0-SNAPSHOT: Failed to collect dependencies at org.mule.transports:mule-transport-file:jar:3.8.4: Failed to read artifact descriptor for org.mule.transports:mule-transport-file:jar:3.8.4: Failure to find org.mule.transports:mule-transports:pom:3.8.4 in http://repo1.maven.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 -> [Help 1]
[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/DependencyResolutionException
Here is the POM file:
<?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.schwab</groupId>
<artifactId>firsttest</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule firsttest Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.8.4</mule.version>
<mule.tools.version>1.2</mule.tools.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>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/app/</directory>
</resource>
<resource>
<directory>src/main/api/</directory>
</resource>
<resource>
<directory>mappings/</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Mule Dependencies -->
<dependencies>
<!-- Xml configuration -->
<dependency>
<groupId>com.mulesoft.muleesb</groupId>
<artifactId>mule-core-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Xml configuration -->
<dependency>
<groupId>com.mulesoft.muleesb.modules</groupId>
<artifactId>mule-module-spring-config-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mule Transports -->
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-file</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-http</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-jdbc-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mulesoft.muleesb.transports</groupId>
<artifactId>mule-transport-jms-ee</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-vm</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mule Modules -->
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-scripting</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-xml</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- for testing -->
<dependency>
<groupId>org.mule.tests</groupId>
<artifactId>mule-tests-functional</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-http</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-spring-config</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-release</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>http://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Any idea of what's going on?
Your help is appreciated.
Maven cannot find transports:mule-transport-file:jar:3.8.4 as it is not available in the Mule Maven repository configured in your pom under <repositories>. This is the Public Mule repository, but it seems the 3.8.4 runtime and its dependencies were not made public, probably only available for Enterprise users. You can see for yourself by browsing the repository, the JAR is missing: https://repository-master.mulesoft.org/nexus/content/repositories/releases/org/mule/transports/mule-transport-file/3.8.4
You can either use Mule 3.8.1 for which your dependency is available (change Mule version in your pom) or configure the Enterprise (EE) repository if you have proper license and access (see https://docs.mulesoft.com/mule-user-guide/v/3.8/configuring-maven-to-work-with-mule-esb)
*Not related note: it seems you are running Mule EE inside Studio. Studio provide EE runtime for testing purposes, so Maven does not complain (too much) about missing EE dependencies, but if you try to run Mule EE outside Studio you will need to configure the EE repository. *
Update Setting.xml with Proxy details,if you are trying from organisation network, it seems it is not able to download all the jars
I am assuming it is your first project. You can disable Maven in order to experience MULE behavior. Right Click on the project and it provides an option to disable Maven. After that you can run your project.

Error while using "mvn install"

Can anyone help me with this error ? I was using "mvn install" command in my warnings-plugin directory.
I got this error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 57:18.440s
[INFO] Finished at: Tue Oct 25 01:59:03 IST 2016
[INFO] Final Memory: 18M/73M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project warnings: Could not resolve dependencies for project org.jvnet.hudson.plugins:warnings:hpi:4.58-SNAPSHOT: The following artifacts could not be resolved: org.jenkins-ci.main:jenkins-war:war:1.625.1, org.jenkins-ci.main:jenkins-test-harness:jar:1.625.1: Could not transfer artifact org.jenkins-ci.main:jenkins-war:war:1.625.1 from/to repo.jenkins-ci.org (http://repo.jenkins-ci.org/public/): GET request of: org/jenkins-ci/main/jenkins-war/1.625.1/jenkins-war-1.625.1.war from repo.jenkins-ci.org failed: Read timed out -> [Help 1]
[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/DependencyResolutionException
My pom.xml file looks like this
<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>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-pom</artifactId>
<version>1.65</version>
<relativePath>../analysis-pom</relativePath>
</parent>
<artifactId>warnings</artifactId>
<packaging>hpi</packaging>
<name>Warnings Plug-in</name>
<version>4.58-SNAPSHOT</version>
<url>http://wiki.jenkins-ci.org/x/G4CGAQ</url>
<description>This plug-in reads the compiler warnings from the console log file and generates a trend report.</description>
<licenses>
<license>
<name>MIT license</name>
<comments>All source code is under the MIT license.</comments>
</license>
<license>
<name>LGPL</name>
<comments>All icons are made by Carlitus (Carles Carbonell Bernado) and are under the LGPL.</comments>
</license>
<license>
<name>BSD license</name>
<comments>All YUI source code is under the BSD license. Duke, the Java mascot also is under the BSD license.</comments>
</license>
<license>
<name>Scala License</name>
<url>http://www.scala-lang.org/license.html</url>
<comments>Scala icons are made by converting of http://www.scala-lang.org/resources/img/smooth-spiral.png</comments>
</license>
<license>
<name>Creative Commons Attribution 3.0</name>
<url>https://creativecommons.org/licenses/by/3.0</url>
<comments>Go mascot and logo were designed by Renée French and are covered by the Creative Commons Attribution 3.0 license.</comments>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-core</artifactId>
<version>1.77</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>violations</artifactId>
<version>0.7.11</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-digester3</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-test</artifactId>
<version>1.18</version>
<scope>test</scope>
</dependency>
</dependencies>
<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:git#github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<tag>HEAD</tag>
</scm>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
I'm on ubuntu 14.04. I installed maven using sudo apt-get install maven.
I'm writing a new parser following [https://wiki.jenkins-ci.org/display/JENKINS/Warnings+Plugin][1] .
[1]: https://wiki.jenkins-ci.org/display/JENKINS/Warnings+Plugin and just following the steps given there.
I have tried to browse the repo you use to download jenkins war :
http://repo.jenkins-ci.org/public/
The server has difficulties to respond. Try that :
http://repo.jenkins-ci.org/public/com/
So, yes, it is well a timeout problem.
Maybe temporary, maybe permanent... I don't know.
Anyway, you have three solutions :
try again later
configure another mvn repository in your pom.xml where the artifact exists
download the war from another website (ex: https://mvnrepository.com/artifact/org.jenkins-ci.main/jenkins-war/1.625.1)
and put it in your maven local repository.

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar

So I was trying to go ahead and create a .ear file for an existing maven project and further deploy it on WebLogic server. For the same, I went ahead to create the WAR,JAR and the EAR module and followed these steps for it -
Right click on parent project, select new, select maven module, Named it as projectnameJARModule and then finished the wizard.
Did the same process for creating a projectnameWARModule and a projectnameEARModule module. Once they were made, I added the WAR and the JAR modules as dependencies to the EAR module.Further, I went ahead to install the maven modules by Right Clicking on the projectnameWARModule folder and chose Run As - Maven Install. Upon this, I get the following error in the console (Full console log below) -
T E S T S
-------------------------------------------------------
Running org.CADJARModule.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # CADJARModule ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] projectname ............................................... SUCCESS [ 0.957 s]
[INFO] projectnameJARModule ...................................... FAILURE [ 33.425 s]
[INFO] projectnameWARModule Maven Webapp ......................... SKIPPED
[INFO] projectnameEARModule ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.806 s
[INFO] Finished at: 2015-12-01T18:16:20+05:30
[INFO] Final Memory: 9M/126M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project projectnameJARModule: Error assembling JAR: For artifact {org.glassfish.jersey.containers:jersey-container-servlet-core:null:jar}: The version cannot be empty. -> [Help 1]
[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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :projectnameJARModule
Any idea how do I get rid of this? Many Thanks
Following is the pom.xml for the Parent 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>
<groupId>Project_name</groupId>
<artifactId>Project_name</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Project_name</name>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version> <!-- Put here the version of your Java EE app, in my case 7.0 -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<jersey.version>2.16</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>Project_nameJARModule</module>
<module>Project_nameWARModule</module>
<module>Project_nameEARModule</module>
</modules>
</project>
Following is the pom.xml for the WAR Module-
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>Projectname</groupId>
<artifactId>Projectname</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>ProjectnameWARModule</groupId>
<artifactId>ProjectnameWARModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ProjectnameWARModule 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>
</dependencies>
<build>
<finalName>ProjectnameWARModule</finalName>
</build>
</project>
Following is the pom.xml for my JAR module -
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>Project_Name</groupId>
<artifactId>Project_Name</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>CADJARModule</groupId>
<artifactId>CADJARModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>CADJARModule</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>
</project>
Let me clarify: the dependencyManagement section provide dependencies governance to the same POM where it is defined and to children/modules Maven projects.
However, declaring a dependency in the dependencyManagement section doesn't mean Maven will use it, it's just an hint in case Maven will use it so that if a certain version is missing in the dependencies section, Maven will look it up in the dependencyManagement section. If none is found then, an error will be generated (Maven couldn't know which version to resolve for a certain dependency).
Hence, good to have the dependencyManagement section for governance, but it should always define versions of each dependency, otherwise it would be a missed opportunity and make your build more error-prone.
If you need all of the declared dependencies and only in the scope of the same declaring POM, then you can actually avoid to have a dependenciesManagement section at all and just have your dependencies section providing versions for each declared dependency.
In this case, you are using a dependenciesManagement section in your parent POM (I see it has modules), you should then check if in the jar module the same dependency is declared (if required), otherwise it will not be used during its build. Moreover, you should also check whether another dependenciesManagement section is declared in the concerned module and re-declaring the same dependency again without version.
Some additional helps can be provided by:
Running your Maven build using the -e -X flags
Running mvn dependency:tree -Dincludes=<concerned_group_id_here>
Last change option, run your build as mvn dependency:purge-local-repository clean install, which can work in case of corrupted cache (error should be different though)

Maven wont install Lwjgl

I'm using maven on eclipse. I want to use Lwjgl and a few other libraries but Maven wont install them. It says they are missing. Here is what it says when I look at the errors:
ArtifactDescriptorException: Failed to read artifact descriptor for slick:slick:jar:274: ArtifactResolutionException: Failure to transfer slick:slick:pom:274 from http://slick.cokeandcode.com/mavenrepo was cached in the local repository, resolution will not be reattempted until the update interval of slick has elapsed or updates are forced. Original error: Could not transfer artifact slick:slick:pom:274 from/to slick (http://slick.cokeandcode.com/mavenrepo): null to http://slick.cokeandcode.com/mavenrepo/slick/slick/274/slick-274.pom pom.xml /TheLabyrinth
Missing artifact java3d:vecmath:jar:1.3.1 pom.xml /TheLabyrinth
Missing artifact junit:junit:jar:4.10 pom.xml /TheLabyrinth
Missing artifact net.java.jinput:jinput-platform:jar:natives-linux:2.0.5 pom.xml /TheLabyrinth line 1 Maven Dependency Problem
Missing artifact net.java.jinput:jinput-platform:jar:natives-osx:2.0.5 pom.xml /TheLabyrinth
Missing artifact net.java.jinput:jinput-platform:jar:natives-windows:2.0.5 pom.xml /TheLabyrinth
Missing artifact net.java.jinput:jinput:jar:2.0.5 pom.xml /TheLabyrinth
Missing artifact net.java.jutils:jutils:jar:1.0.0 pom.xml /TheLabyrinth
Missing artifact org.hamcrest:hamcrest-core:jar:1.1 pom.xml /TheLabyrinth
Missing artifact org.lwjgl.lwjgl:lwjgl_util_applet:jar:2.8.4 pom.xml /TheLabyrinth
Missing artifact org.lwjgl.lwjgl:lwjgl_util:jar:2.8.4 pom.xml /TheLabyrinth
Missing artifact org.lwjgl.lwjgl:lwjgl-platform:jar:natives-linux:2.8.4 pom.xml /TheLabyrinth
Missing artifact org.lwjgl.lwjgl:lwjgl-platform:jar:natives-osx:2.8.4 pom.xml /TheLabyrinth
Missing artifact org.lwjgl.lwjgl:lwjgl-platform:jar:natives-windows:2.8.4 pom.xml /TheLabyrinth
Missing artifact org.lwjgl.lwjgl:lwjgl:jar:2.8.4 pom.xml /TheLabyrinth
The container 'Maven Dependencies' references non existing library 'C:\Users\Wyatt\.m2\repository\java3d\vecmath\1.3.1\vecmath-1.3.1.jar' TheLabyrinth
The project cannot be built until build path errors are resolved TheLabyrinth
So as you can see it doesn't seem to be working very good. But looking at the errors it seems to be something wrong with my pom.xml so here's a copy of that:
<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.awsp8.labyrinth</groupId>
<artifactId>TheLabyrinth</artifactId>
<version>1.0.0</version>
<name>The Labyrinth</name>
<description>You are stuck in a room, no way out... Or so you think.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<natives.version>0.0.6</natives.version>
<lwjgl.version>2.8.2</lwjgl.version>
<slick.version>274</slick.version>
<junit.version>4.10</junit.version>
</properties>
<repositories>
<repository>
<id>mavenNatives</id>
<name>Maven Natives Repository</name>
<url>http://mavennatives.googlecode.com/svn/repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>slick</id>
<name>slick</name>
<url>http://slick.cokeandcode.com/mavenrepo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl_util</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl_util_applet</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>slick</groupId>
<artifactId>slick</artifactId>
<version>${slick.version}</version>
</dependency>
<dependency>
<groupId>java3d</groupId>
<artifactId>vecmath</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<plugin>
<groupId>com.googlecode.mavennatives</groupId>
<artifactId>maven-nativedependencies-plugin</artifactId>
<version>0.0.5</version>
<executions>
<execution>
<id>unpacknatives</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
</plugin>
</project>
Am I doing something wrong? Thanks in advance.

Categories

Resources