i have a repository setup like this
<repository>
<id>jboss</id>
<name>JBoss Repository for Maven</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>itextpdf.com</id>
<name>Maven Repository for iText</name>
<url>http://maven.itextpdf.com/</url>
</repository>
how do i set up the dependency to use the itext repository only for itext and jboss for everything else. for some reason the dependencies are being downloaded by both and one of them that is in the itext repository is different than the jboss and is crashing my system.
You shouldn't need to do this if the artifact only exists in one of the repositories (maven will try each repository in order and will stop once it finds it). The itext repo doesn't have any of the jboss jars so listing it first should result in it being checked first (and when it fails to resolve the jboss jars, it'll try the jboss repo).
Alternatively, if you have your own Maven repository server (Nexus, for instance), acting as a proxy for the public maven repositories, you can set up a "Repository Routing" in which you tell it which repositories to search for specific artifacts (based on group ID).
Related
I currently have artifactory set up on my jenkins pipeline correctly. I can see that it does indeed fetches artifacts but I noticed there is a few artifacts that arent being pulled. These artifacts dont seem to be in my jfrog server but i do specify in the POM file where they can be found and pulled. Here they are:
<repository>
<id>osgeo</id>
<name>OSGeo Release Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
<repository>
<id>osgeo-snapshot</id>
<name>OSGeo Snapshot Repository</name>
<url>https://repo.osgeo.org/repository/snapshot/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
</repository>
I guess maven/jenkins only checks my artifactory server and doesnt reach out to these repos at all. Is there a way where I can tell maven to not just look in my artifactory repo and also look in these repos as well? I have this snippet of code in my main pom file so im clueless as to why it doesnt pull from them.
Artifactory does reach out these remote endpoints if they are configured. Check if these "https://repo.osgeo.org/repository/snapshot" and "https://repo.osgeo.org/repository/release" are configured in the remote repository and if not, create the maven remote repositories in Artifactory and point the URL textbox to these remote endpoints. Add these 2 remote repositories in the Maven virtual repository and try to pull from Artifactory.
What do repositories must I add need to enable consumption of teiid-admin via maven?
Why does a released version of teiid depend on a pre-release ancestor pom (org.jboss.as:jboss-as-parent:pom:7.5.0.Final-redhat-15 pom file in the jboss "Product EAP 6.4.0 Alpha" repository)
I must be doing something wrong because I can't add Teiid admin to my project because the pom ancestry disappears into a non release repository. Does this seem right?
Error Seen
Could not find artifact org.jboss.as:jboss-as-parent:pom:7.5.0.Final-redhat-15 in org.reficio (http://repo.reficio.org/maven/) # org.jboss.teiid:teiid-parent:8.12.0.Alpha3-SNAPSHOT,...pom.xml, line 376, column 23 -> [Help 2]
Dependency Added
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-admin</artifactId>
<version>8.11.0.Final</version>
<!-- same basic thing happens with <version>8.11.2</version> -->
</dependency>
I can see org.jboss.as:jboss-as-parent:pom:7.5.0.Final-redhat-15 pom file on the jboss "Product EAP 6.4.0 Alpha" repository
I cannot find it in the release repository.
When I attempt to list either of these as dependency or build the equivalent source for teiid admin tags I get a variation on that error.
Please let me know if you have any ideas because after hunting around the jboss nexus instance I'm more confused than when I started.
Thanks
Peter
Question and answers from Jboss Community provided the solution. To use teiid via maven one must proxy or add all these repos to your settings file
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
<id>jboss-developer-repository-group</id>
<name>JBoss Developer Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/developer/</url>
<id>jboss-techpreview</id>
<name>JBoss Tech Preview</name>
<url>https://maven.repository.redhat.com/techpreview/all/</url>
<layout>default</layout>
<id>jboss-earlyaccess</id>
<name>JBoss Early Access</name>
<url>https://maven.repository.redhat.com/earlyaccess/all/</url>
I'm new to CQ5 and looking for steps/settings I may need to do to setup an AEM adobe CQ5 6.1 project to build/install offline (not connected to internet).
I've to use our internal network Nexus (which has lot of general dependencies available except AEM related).
I've to use Maven & Java7.
Looking for possible issues/resolutions, steps & any helpful info.
Thanks all for your inputs.
After a detailed investigation, this is now resolved. Just want to share the findings so that it may help others.
The content-package-maven-plugin which was uploaded to our local nexus got corrupted.
Interestingly maven was not throwing any errors when i was trying mvn install command on my AEM project. Rather it was giving NoClassDefFound error for a further dependency of content-package-maven-plugin.
From the output of, mvn dependency:resolve-plugins, it was confirmed that the dependencies are not fully resolved for particular this plugin JAR, I tried to manually download the artifact from nexus & try to open/unjar it.
The artifact pom was corrupted and hence I uploaded the fresh artifact in nexus, and this time all went smooth.
My AEM project is now building fine with local nexus dependencies.
a typical AEM project does have lots of dependencies. There are some dependencies for the AEM platform(including granite, sling, osgi etc). These dependencies are downloaded from the adobe public repositories, unless you have a nexus repository in your company where all these dependencies are available.
If your Organization specific Nexus repository can connect to internet and download dependencies (AEM and non AEM related) atleast for the first time , then you do not need to connect to internet from your local sand box.
Theoretically, your organization specific nexus repo also might not be
connected to the internet and all the JARs can be uploaded to Nexus
manually. But, that would be the last thing I will do in my life !
Your project can download all the dependencies from the Nexus repo(only) in multiple ways.
Configure the repository configuration in your pom.xml file to point
to your internal Nexus repo.
<repositories>
<repository>
<id>internal</id>
<name>Internal Public Repository</name>
<url>URL to the public repository of your internal nexus</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>internal</id>
<name>Internal Public Repository</name>
<url>URL to the public repository of your internal nexus</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
Change your Maven settings (settings.xml) to use your internal Nexus
every time it downloads dependencies (Recommened).
settings.xml can be found in your <user>/.m2 directory or <maven-installation>/conf
<mirrors>
<mirror>
<id>public</id>
<mirrorOf>*</mirrorOf>
<url>URL to the public repository of your internal nexus</url>
</mirror>
</mirrors>
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 have just moved to a new machine and installed a new maven (version 3) but it keeps complaining about project dependencies even though I can see them in the repository myself and all the repository declarations in pom.xml are correct. i can paste their url in the browser and they resolve fine. Some are even in the .m2 folder.
most of the ones it complain about are those from jboss
<repository>
<id>jboss-repository</id>
<name>Jboss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
any ideas?
Tx
Looks like the URL is not correct. It should be
http://repository.jboss.org/nexus/content/groups/public/