When I try to to install maven project in local repository, I notice that pom and jar files have .lastUpdated extension. Because of this issue I cannot build my project which depends on it.
Could you please explain why it happens?
I've found the answer here :
When an artifact is unable to be downloaded, Maven 3 caches this result for future reference in the "~/.m2/repo/.../.lastUpdated" file. For "not found" situations, it seems that the HTTP code could be used to more granularly re-attempt retrieval rather than just cache the failure.
For example, for any 404, I agree, the result should cache the failure and require a -U to attempt to retrieve it again. However, for 400, 500, 501, 502, 503, 301, 302 (what's the Maven behavior for 3xx today?) I think the resolution engine should try to re-retrieve the artifact each time. With those error codes, it seems more likely a config issue or brief network hiccup, not one of the file being absent from that repo. However, that brief network hiccup has longstanding cache implications in that the file is never attempted to be retrieved again.
It also can happen when you refer to the artifact which is listed under Maven Repository but is not there physically. E.g., the following Exasol artifact is listed under Maven Repository, but there's a small side note which tells that:
Note: this artifact i[s] located at Exasol repository
(https://maven.exasol.com/artifactory/exasol-releases/)
This means that you need to separately add another repository (in this case Exasol) as a source in your pom.xml file:
<!-- add the dependency as mentioned in maven website -->
<dependencies>
<dependency>
<groupId>com.exasol</groupId>
<artifactId>exasol-jdbc</artifactId>
<version>6.2.1</version>
</dependency>
</dependencies>
<!-- add the actual repository which unfortunately isn't mentioned in maven website -->
<repositories>
<repository>
<id>maven.exasol.com</id>
<url>https://maven.exasol.com/artifactory/exasol-releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Related
I would like to create a plugin for Gephi but I got an error when running Maven and the project is not supported since 4 years... I already posted my question as an issue but I think no one will answer me now.
I forked the git and tried to follow instructions in the README to create my own plugin, but when I run this command :
mvn clean package
I constantly get this error :
[ERROR] Failed to execute goal on project gephi-plugins: Could not resolve dependencies for project org.gephi:gephi-plugins:pom:0.9.2: Failed to collect dependencies at org.gephi:gephi:tar.gz:linux:0.9.2 -> org.netbeans.cluster:platform:pom:RELEASE82: Failed to read artifact descriptor for org.netbeans.cluster:platform:pom:RELEASE82: Could not transfer artifact org.netbeans.cluster:platform:pom:RELEASE82 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [netbeans (http://bits.netbeans.org/nexus/content/groups/netbeans/, default, releases)] -> [Help 1]
I'm new with Maven and issues #77 and #214 didn't help me, I just followed instructions in the README file.
I followed the link given by the error and a blank page with this text appeared :
Repository decommissioned. Please refer to https://netbeans.apache.org/about/oracle-transition.html for more information.
And after clicking the link above, I thought this part was interesting :
As of March the 6th, 2021, we’ll be standing on our own feet, and all the Apache NetBeans Project source and convenience binaries will be hosted by the Apache Infra Team.
And then, a "new" code for handling netbeans repository
<build>
<repositories>
<repository>
<id>netbeans</id>
<name>NetBeans</name>
<url>http://netbeans.apidesign.org/maven2/</url>
</repository>
</repositories>
<build>
Is that possible that the pom.xml file is not up to date ? Or am I missing something ?
I spoke with someone who already used Maven at the office and he said that none of gephi repositories are working with Maven, all of them display the error.
Thanks for the help !
Finally the solution was quite simple :
The NetBeans repositories have indeed changed, so, in modules/pom.xml :
<repository>
<id>netbeans</id>
<name>NetBeans</name>
<url>http://bits.netbeans.org/nexus/content/groups/netbeans/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
We have to change the <url> tag to :
<url>http://netbeans.apidesign.org/maven2/</url>
I did that and it didn't work because my Maven version didn't support non secure url repositories (http) and I need to add a "s" in order to make it works.
<url>https://netbeans.apidesign.org/maven2/</url>
For a reason that I don't know, the project still not compile and we have to go to the parent pom.xml on the root folder and add the same NetBeans repository than above.
After doing that it compile.
I don't know if this is normal, but I'm new to Maven and I didn't know : if you want to use some gephi packages in your module (and wou want) you have to add them into module/YourModule/pom.xml in the <dependencies> tag ! Like that :
<dependencies>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>layout-api</artifactId>
<version>0.9.2</version>
</dependency>
<dependency>
<groupId>org.gephi</groupId>
<artifactId>graph-api</artifactId>
<version>0.9.2</version>
</dependency>
<!-- ... -->
</dependencies>
I tested it with the GridLayout plugin from the Gephi Plugins Bootcamp and it worked.
We have a project with multiple parent/child POMs. All the POMs are pointing to a single repository for resolving all Maven dependencies.
Now I have a need like: In a single POM, one jar has to be downloaded from repo1 and rest 4-5 jars from repo2.
How can you do that?
In a word - yes. Maven's dependency resolution mechanism is completely separate from the repository mechanism. Theoretically, you could have every single jar delivered from its own repository (however ridiculous it may to actually do this).
What I have understand the,
I can setup maven repo in artifactory/nexus
e.g. http://localhost:18081/artifactory/ --> L1
1. create remote(R1) repository in artifactory, which can point URL to outside repository, hosted by artifactory/nexus
e.g http://remotehost:18081/artifactory/remote-repo1
2. create a "virtual" repository(V1) in my artifactory and add remote(R1) in to this V1.
3. Let all my poms points to my local artifactory virtual repository(V1),
e.g.>http://localhost:18081/artifactory/virtual
that way, maven will look
a. local .m2 folder
b. then look for jars in virtual repo of my artifactory
hence virtual will look
b1. all local repo
b2. all remote cache repo
b3. all remote repo --> e.g.http://remotehost:18081/artifactory/remote-repo1
I am experimenting this,once succeed, i will update
EDIT :
This has worked for me, the only hiccup I faced was my ~/.m2/settings.xml
the snapshot was false, and my jar in remote repo is a snapshot jar.
After changing this value to true, now its fetching the jars :)
</profile>
<profile>
<id>virtual-repo</id>
<repositories>
<repository>
<id>central</id>
<url><repo_url></url>
<snapshots>
**<enabled>true</enabled>**
</snapshots>
</repository>
</repositories>
My organization is attempting to release some open source into this world and we are starting with some of our libraries. Currently what I have is published some artifacts into the organization's location. They are available here and can be seen here:
They are not currently linked to JCenter, because I am OK for now using the explicit repo provided.
However any attempt to resolve them through maven results in:
http://dl.bintray.com/bds/sdk/
[ERROR] Failed to execute goal on project protex-plugin-integration: Could not resolve dependencies for project com.blackducksoftware.plugins:protex-plugin-inte
gration:jar:1.1.1: The following artifacts could not be resolved: com.blackducksoftware.protex:protex-sdk-client:jar:6.4.2, com.blackducksoftware.protex:protex-
sdk-utilities:jar:6.4.2: Could not find artifact com.blackducksoftware.protex:protex-sdk-client:jar:6.4.2 in bintray-bds-sdk (http://dl.bintray.com/bds/sdk) ->
[Help 1]
This is odd to me since the files are definitely visible via said URL.
Is what I am doing impossible and I must submit to JCenter and be accepted first?
The pom contains:
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-bds-sdk</id>
<name>bintray</name>
<url>http://dl.bintray.com/bds/sdk</url>
</repository>
</repositories>
Your repository is well configured in the POM, but the error reported is true: In the http://dl.bintray.com/bds/sdk/com/blackducksoftware/protex/protex-sdk-client/6.4.2 location you cannot find the protex-sdk-client-6.4.2.jar library; the only existing JAR file has the version missing in its name.
You should review the deployment procedure: For some reason (maybe the finalName, or some other parametrization in the maven-jar-plugin), the library is being published without the version suffix.
I am new to Maven. If I start new project with Maven, should I know any repository URLs for it to work?
For example, this Hibernate tutorial http://docs.jboss.org/hibernate/core/3.3/reference/en/html/tutorial.html says about how to create a sample project with pom.xml text. But this pom.xml does not contain any repositories.
So, my m2eclipse plugin says, for example Project build error: 'dependencies.dependency.version' for org.hibernate:hibernate-core:jar is missing., for all dependency tag in pom.xml
Is this because of repositories absence?
Where to know repositories URLs? Is there one big repository? Why doesn't it included by default?
UPDATE 1
It is said here, that Maven should use "central" repository by default: http://maven.apache.org/guides/introduction/introduction-to-repositories.html
I have searched there for hibernate-code artifact and found it. So, this artifact IS in central repository. By my maven says dependency not found. Hence it doesn't use it's central repository. Why?
Apparently your Hibernate dependency is missing <version> tag:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.9.Final</version> <!-- this line is missing -->
</dependency>
Note that you don't have to specify version of dependencies previously declared in <dependencyManagement>.
Old answer:
Every build script (not only with Maven) should be reproducible and independent from environment. Standard pom.xml (called super pom), which every pom.xml inherits from, already defines main Maven central repository:
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
You don't have to define this repository, and you don't have to define any others if all your dependencies are there. On the other hand if you are using some external repositories, you must add them to pom.xml, so that every developer is always able to build.
The bottom line is: if you can build the project having a completely empty repository, your pom.xml is fine.
It's not advisable to define repositories in POM files as that causes a lot of issues (Maven will search those repositories for ANY artifact even the ones available at Central, poor portability, ...)
Best approach: Setup a repository manager (Artifactory, Nexus) and edit your settings.xml file to use the repo manager as a mirror.
Second best approach: Define the required repositories in your settings.xml file, not in your pom.xml files.
Repositories in poms is a bad idea.
I am working on project which has multiple dependencies. Most of the dependencies are available at our centralized maven repository. My project includes some JARs which only specific to my application and unavailable at our Maven repo. Due to some policy/restriction i cant deploy that jars to our maven repository.
When i install these jars in my local repository(i.e.UserHome/.m2/repository) and compile the code its working fine.
Now i want these dependencies in SVN so that we can build the application package using Continuum.(We cant refer local dependency from Continuum server.)
Just to achieve these i copied the locally installed dependency from .m2/repository and committed it in SVN. Then i declared repository in pom.xml like..
<repositories>
<repository>
<id>repo.pu</id>
<name>repo.pu</name>
<url>https://URL/migration2/APP1/src/main/lib/</url>
<layout>default</layout>
</repository>
</repositories>
Now to use dependency from above repo i added code like...
<dependencies>
<dependency>
<groupId>repo.pu</groupId>
<artifactId>Ptestval</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
When i type mvn verify i am getting the below error..
[ERROR] Failed to execute goal on project APP1: Could not resolve dependencies f
or project fileservices.migration2:APP1:jar:1.0: Failed to collect dependencies
for [repo.pu:Ptestval:jar:1.0 (compile)]: Failed to read artifact descriptor for
repo.pu:Ptestval:jar:1.0: Could not transfer artifact repo.pu:Ptestval:pom:1.0
from/to repo.pu (https://URL/migration2/APP1/src/main/lib/): Access denied to:
https://URL/migration2/APP1/src/main/lib/repo/pu/Ptestv
al/1.0/Ptestval-1.0.pom -> [Help 1]
Could you please someone help me to resolve these issue?
EDIT: I created a repository like ..
<repositories>
<repository>
<id>repo.pu</id>
<name>repo.pu</name>
<url>https://SVNUserName:SVNPassword#SVN_URL/BaseProj/ProjA/src/main/lib</url>
<layout>default</layout>
</repository>
</repositories>
This technique works perfectly at my Personal laptop. Maven downloads the listed dependency from repo.
But when tries to use the same in my project on company network it is not working .. It gives the same error which i was getting before using this approach.
Can anyone help me please? What would be problem? Is it a network issue?
Set up a repository manager like Nexus and don't abuse Subversion for something it was not designed for. This is unfortunately done in Google Code.
You must configure your project to use wagon-scm.
See http://maven.apache.org/wagon/wagon-providers/wagon-scm/usage.html