what is the error when integrating maven with Struts 1.3 with local project libraries? - maven

I have some local jar files in my 'projectBaseDir/lib' location and i have added the directory with the following maven command
<repositories>
<repository>
<id>mylibid</id>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
still, the following command shows that it doesn't find any library / showing errors.
mvn clean install
Here is a screenshot -

Create a new folder, let's say local-maven-repo at the root of your Maven project.
Just add a local repo inside your of your pom.xml:
<repositories>
<repository>
<id>local-maven-repo</id>
<url>file:///${project.basedir}/local-maven-repo</url>
</repository>
</repositories>
Then for each external jar you want to install, go at the root of your project and execute:
mvn deploy:deploy-file -DgroupId=[GROUP] -DartifactId=[ARTIFACT] -Dversion=[VERS] -Durl=file:./local-maven-repo/ -DrepositoryId=local-maven-repo -DupdateReleaseInfo=true -Dfile=[FILE_PATH]

Related

Could not resolve dependency from local repo in POM

Hi I am trying to add a local jar file to maven dependency like below in POM.xml.
<repositories>
<repository>
<id>project-repo</id>
<url>file://C:/POC/Projects/Jar</url>
</repository>
</repositories>
I am always getting below error.
Could not find artifact cas:cas:jar:1.2 in project-repo (file://C:/POC/Projects/Jar)
How i can fix this issue?
The JAR needs to be installed to the local repo.
Executing the command below will install the JAR to local repo:
mvn deploy:deploy-file -DgroupId=[group] -DartifactId=[artifact] -Dversion=[vers] -DrepositoryId=project-repo -Dfile=[JAR_FILE_PATH]

Maven Tycho: Cannot add artifact descriptor which has not been created by this repository

I'm trying to build an RCP application via Tycho and I receive this error when exporting the product.
I don't really understand the issue, but could it be that the reason why it fails it's because I'm using multiple P2 repositories to retrieve my plugins dependencies?
This is the snipped of the repositories I've defined in my parent POM. The rest is pretty standard Tycho.
<repositories>
<repository>
<id>eclipse-luna</id>
<url>${eclipseLuna}</url>
<layout>p2</layout>
</repository>
<repository>
<id>systems-rc-p2</id>
<url>${systemsRcP2}</url>
<layout>p2</layout>
</repository>
<repository>
<id>systems-snapshots-p2</id>
<url>${systemsSnapshotsP2}</url>
<layout>p2</layout>
</repository>
</repositories>
I found the issue.
Basically for some reason (project needs) I had to change the "sourceDirectory" and the "outputDirectory" of the project, pointing them to the classic "src" and "bin" instead of the Maven default "src/main" and "target".
In particular, what was causing the issue was the redefinition of the <outputDirectory> property and the <directory> one. It looks like Tycho does not like it at all.

How to use the target folder of another project as target platform repository in a Tycho build?

I am creating an Eclipse plugin in an continuous integration environment. My project contains four child modules as follows
parent
---p2Repository
---eclipseplugin
---feature
---updateSite
During the continuous integration build, first the p2 repository for the dependencies is created. My Eclipse plugin project needs to point to the p2Repository's target folder to get the dependecies. But by providing the following code in the eclipse-plugin POM file is not working:
<repositories>
<repository>
<id>Dependencies</id>
<layout>p2</layout>
<url>file:/../p2Respository/target/repository/</url>
</repository>
</repositories>
Any advice?
The file URL you specified does not represent a relative path, and relative URLs are not supported in the repositories configuration.
But you can simply construct an absolute URL pointing to the sibling project's target folder by using the ${project.baseUri} Maven property:
<repositories>
<repository>
<id>Dependencies</id>
<layout>p2</layout>
<url>file:/${project.baseUri}/../p2Respository/target/repository/</url>
</repository>
</repositories>

Maven: Error resolving version for plugin

I am trying to get Batik working, having not worked with Java much in the last ten years or so and I'm running into problems with Maven being able to find the org.apache.maven.wagon:wagon-ssh-external package.
When I open or try to build the project in Netbeans, it reports the following error:
The project org.freehep:freehep-graphicsio:2.1.1 (/home/glenatron/Projects/batik/freehep-graphicsio/pom.xml) has 1 error
Unresolveable build extension:
Error resolving version for plugin 'org.apache.maven.wagon:wagon-ssh-external' from the repositories [local (/home/glenatron/.m2/repository), freehep-maven (http://java.freehep.org/maven2), central (http://www.ibiblio.org/maven2), Codehaus (http://repository.codehaus.org/), Codehaus Snapshots (http://snapshots.repository.codehaus.org/)]:
Plugin not found in any plugin repository -> [Help 2]
As far as I can tell this is correct, however, I have the following in my pom.xml file for the project:
<repositories>
<repository>
<id>freehep-maven</id>
<name>Maven FreeHEP</name>
<url>http://java.freehep.org/maven2</url>
</repository>
<repository>
<id>maven-apache</id>
<name>Maven Apache</name>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>maven1</id>
<name>Maven.org</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
From what I can judge a) that plugin should be available in one of those repositories and b) if they are in the pom.xml file, Maven should be searching them but I can't see any sign of it doing that.
The project I am trying to work with is the FreeHEP EMF driver. The bigger screen solution was to use the unsignposted but much more up to date Github repository version.
It turns out that the solution was in the message after all: Error resolving version for plugin.
So obviously it's not a repository it is a pluginRepository which goes in a different part of pom.xml:
<pluginRepositories>
<pluginRepository>
<id>maven1</id>
<name>Maven.org</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
Remove the entries with repo1... cause this is maven Central and used by Maven by default so no need to define it explicit. Furthermore the given freehep.org is also available via Maven Central. So if i see it correct you don't need to define supplemental repositories at all.

Maven: adding dependency not present in the mirror

We are using a local nexus mirror for all of our dependencies.
I need the following dependency in one of the projects:
<depedency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>3.0</version>
</depedency>
from the repository: http://www.smartclient.com/maven2
But maven is giving me error saying that "Failure to find com.smartgwt:smartgwt:jar:3.0".
What might be the problem and how can I solve it?
(Maybe this is very trivial question but I am fairly new to Maven)
I'm assuming Nexus is working for all your standard dependencies hosted on Maven Central.
You can work out where Maven is downloading from by turning on debugging with the -X parameter when doing a build. There will be a lot of noise but if you look a few lines above where your build fails because of failing to find the dependency, it will tell you:
where it is trying to download the dependency
whether it is using a mirror
if there are any HTTP error codes when downloading
How is http://www.smartclient.com/maven2 set up in your Nexus proxy? As a separate proxy repository? Can Nexus access this repo (is it 'In Service' and not blocked)?
Is this repository in Nexus added to the 'public' group? If you don't want this then:
You have to configure a separate mirror in your settings.xml for this repository which points to the URL in Nexus.
Also check that you have added the repository in your POM, e.g.
<project>
...
<repositories>
<repository>
<id>smartclient</id>
<name>SmartClient Maven Repository</name>
<url>http://www.smartclient.com/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
...
</project>
And then configure a proxy entry in your settings.xml for this repository:
<settings>
...
<mirrors>
<mirror>
<id>smartclient-nexus-proxy</id>
<mirrorOf>smartclient</mirrorOf>
<url><url of your smartclient proxy repository in Nexus></url>
</mirror>
...

Resources