How to resolve dependencies in Bamboo build? - java

I have created bamdoo build wich checkouting git repository and started sbt build with tests. There are several sbt reposotories including one from local network. So bamboo build fails with strange message:
[0m ::::::::::::::::::::::::::::::::::::::::::::::[0m
[0m :: UNRESOLVED DEPENDENCIES ::[0m
[0m ::::::::::::::::::::::::::::::::::::::::::::::[0m
[0m :: org.jboss.logging#jboss-logging;${version.jboss.logging}: not found[0m
In logs I see:
Resolving org.jboss.logging#jboss-logging;3.1.1.GA
So ${version.jboss.logging} was resolving correct.
But further logs are frustrating for me:
http://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/${version.jboss.logging}/jboss-logging-${version.jboss.logging}.pom
http://myRepo/repo/org/jboss/logging/jboss-logging/${version.jboss.logging}/jboss-logging-${version.jboss.logging}.pom
Why sbt tries this URLs with ${version.jboss.logging} instead of 3.1.1.GA?
Is it normal for sbt to log dependecies URL without resolving versions variables or not?
How to resolve this?
Important
My Project do not depend on org.jboss.logging directly, it is a transitive dependency.
On my local machine not on bamboo server this project compiles successfully without unresolved dependencies even if I delete whole local sbt repository.
I have manually uploaded jars to the local network repository. And it did not help.

Related

while adding poi -ooxml dependency in sts4 I am getting an error - cannot transfer

I am getting an error while adding poi - ooxlm dependency in my Rest assured project . I need to add Excel file interaction to handle data .
The error I am getting is "Could not transfer artifact org.apache.poi:poi-ooxml-lite:jar:5.2.2 from/to snapshots (https://artifacts.apple.com/libs-snapshot): artifacts.apple.com org.eclipse.aether.transfer.ArtifactTransferException: Could
not transfer artifact org.apache.poi:poi-ooxml-lite:jar:5.2.2 from/to snapshots (https://artifacts.apple.com/libs-snapshot): artifacts.apple.com at "
my pom.xml is
You don't show much of the relevant parts of your pom.xml; also including the relevant snippets as text is easier than a screenshot.
But org.apache.poi:poi-ooxml-lite is available on maven central, so that's where your project should look.
https://artifacts.apple.com/libs-snapshot does not resolve for me, this might be a company internal maven repository that you're using?
There are a few things you can check:
Open the file .m2\repository\org\apache\poi\poi-ooxml-lite\5.2.2\poi-ooxml-lite-5.2.2.jar.lastUpdated and check the error message for each repository. Check why it can't reach maven central; is it missing from the list or giving an error? This might be a company firewall/policy issue perhaps? Or is it giving an error on HTTPS/TLS protocol level?
Check with mvn help:effective-pom what your current listed (plugin) repositories are
Check if you can add maven central to your repositories list if it's missing somehow (should be included by default). Check if it's HTTP or HTTPS, only secure is supported now.
Check in your main maven repository which versions of this jar are available / mirrored, and depend on that version instead (if you can't get maven central to work).
Run your maven command with -X for debug mode to investigate further

Deploying Cloud Function with private dependencies

this is my first question on SO I'll try my best to make it good.
My team deploys multiple Java Cloud Functions (GCP) using a few common classes (with maven to manage dependencies). Right now those classes are duplicated in each function and have to be updated everywhere at each code edit. Each Cloud Function is deployed from source.
To avoid duplicating those classes I packaged them in a jar, everything runs fine locally. I added this jar as a local dependency in each Cloud Function pom file and tried to deploy from jar by building a jar with all dependencies and providing it in the --source option of gcloud deploy. This causes a timeout error from what seems to be the jar uploading.
Error trace :
DEBUG: Starting new HTTPS connection (1): storage.googleapis.com:443
DEBUG: Caught socket error, retrying: ('Connection aborted.', timeout('The write operation timed out',))
What I tried so far :
Setting a higher deployment timeout with gcloud config set app/cloud_build_timeout 10000 but this doesn't seem to apply to the uploading step as it fails always after a few minutes.
Uploading my local dependency to a private nexus repository to deploy my functions from source as before, but the pull failed on a Wagon error when I run mvn package and I didn't find any solution either : WagonTransporterFactory: Unsupported transport protocol
Detailed error :
[ERROR] Failed to execute goal on project get-content: Could not resolve dependencies for project project:cf:jar:1.0: Failed to collect dependencies at project:pipeline:jar:0.0.1: Failed to read artifact descriptor for project:pipeline:jar:0.0.1: Could not transfer artifact project:pipeline:pom:0.0.1 from/to project-nexus (XXX): Cannot access XXX with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access XXX using the registered transporter factories: WagonTransporterFactory: Unsupported transport protocol -> [Help 1]
I beleive this is only due to my jar with dependencies being to large for upload as I actually deployed the jar without dependency by mistake first (deploy succeded but class definition missing during execution). My question is how can I deploy my Cloud Function with one local/private dependency ?
Note :
I can't upload my dependency to a public maven repository
Each Cloud Function depends also on public maven dependencies which seems to be too large to package in a single jar for deployment
I solved this by switching from Maven to Gradle.
The problem was that Maven stores the repository authentification parameters in a local file ~/.m2/settings.xml that Google Build can't access when building my Cloud Function for deployment.
I switched to Gradle to provide the authenfication in the gradle.build file directly following this question.

Maven artifact in Artifactory cannot be found

The situation: we have a Jenkins job that builds a jar and publishes it to Artifactory, in a custom maven repo. The pom and maven-metadata.xml files are generated, and Anonymous has been given read access to the repository. I've added the repository to my maven settings.xml and verified that maven sees the profile containing the artifactory settings. Despite all this, artifactory still won't resolve the dependency, even though everything looks like it should work. We're just integrating Artifactory into our build process, so we don't have any Artifactory expertise, and Google hasn't turned up anything helpful so far.
UPDATE: I located the original problem - Artifactory couldn't locate the jar in the repo because it wanted an exact match to the jar name, including the timestamp, which is useless for maven. Having fixed that, I'm now running into a further problem.
From the Artifactory log:
2017-11-17 10:09:15,838 [http-nio-8081-exec-2] [WARN ]
(o.a.r.RemoteRepoBase:437) - jcenter: Error in getting information for
'org/tiaacref/ted/digital-metrics-commons/1.1-SNAPSHOT/digital-metrics-commons-1.1-SNAPSHOT.jar'
(Failed retrieving resource from
https://jcenter.bintray.com/org/tiaacref/ted/digital-metrics-commons/1.1-SNAPSHOT/digital-metrics-commons-1.1-SNAPSHOT.jar:
Unknown host - jcenter.bintray.com).
Why is Artifactory going to an external URL to try to resolve an artifact contained in a local repository???

Why is m2e not finding some of my snapshot dependencies from nexus?

In eclipse when I build I get the following warnings:
2/18/14, 4:30:35 PM MST: [INFO] Using org.maven.ide.eclipse.wtp.WarLifecycleMapping lifecycle mapping for MavenProject: com.foo:bar:14.4.19-SNAPSHOT # C:\dev\code\apps\iv\pom.xml.
2/18/14, 4:30:35 PM MST: [WARN] The POM for com.foo.libraries:s2j:jar:1.0.3-SNAPSHOT is missing, no dependency information available
2/18/14, 4:30:35 PM MST: [WARN] The POM for com.foo.libraries:caching:jar:1.0.1-SNAPSHOT is missing, no dependency information available
2/18/14, 4:30:35 PM MST: [WARN] The POM for com.foo.libraries:email:jar:1.0.1-SNAPSHOT is missing, no dependency information available
...
And so on. The build does not complete and I am unable to get anything more in my target directory than the m2e-wtp/web-resources folder.
When I build from the command line, there are no issues, these artifacts are found just fine. They certainly are in my local repository, why does this happen?
Some further details from experiments:
Deleting my local repository and rebuilding in eclipse downloaded some of the artifacts, but resulted in more artifacts to not be found (originally I had 5 missing artifacts, now I have 7). Those that were not found were not downloaded from Nexus.
After having deleted the repository in the experiment above, I then built from the command line and those artifacts that had been listed as missing were downloaded and the build was successful. However, going back to eclipse results in the same errors (despite now having them in my local repository).
Inside eclipse when I "Run As" > "Maven Install" The missing artifacts are downloaded and are found. If I do an eclipse "Build Project" after this I still get the same issue.
Other projects within eclipse are experiencing the same issues on the same artifacts.
Something similar happened to me once. I've checkout com.foo:bar as well as com.foo.libraries:s2j, but I haven't configure the library as maven project in eclipse. So the maven install worked just fine (only the pom file was used), but the eclipse build failed.
So check that all the projects are configured as maven ones and try Maven > Update project and check Force update of snapshots and Clean projects.
I found the solution.
Apparently when I did a mass close of workspace resolved projects some of them were left in a bad state. It looks like eclipse was trying to find the jar as a workspace resolved project, but the projects were closed and caused the result that they didn't exists (instead of looking at my local repository).
Once I opened (and then closed) the respective project for each of the missing dependencies they were then found in my local repository.

Maven artifacts cannot be resolved when trying to install to Ubuntu

I am trying to install a project on Ubuntu server but I am receiving the following error:
[ERROR] Failed to execute goal on project db: Could not resolve dependencies for project com.company.soft.prod:db:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: commons-codec:commons-codec:jar:1.5, mysql:mysql-connector-java:jar:5.1.26, org.springframework:spring-jdbc:jar:3.2.4.RELEASE, org.springframework:spring-beans:jar:3.2.4.RELEASE, org.springframework:spring-core:jar:3.2.4.RELEASE, org.springframework:spring-tx:jar:3.2.4.RELEASE, org.springframework:spring-orm:jar:3.2.4.RELEASE, aopalliance:aopalliance:jar:1.0, org.hibernate:hibernate-core:jar:3.5.1-Final, antlr:antlr:jar:2.7.6, commons-collections:commons-collections:jar:3.1, dom4j:dom4j:jar:1.6.1, xml-apis:xml-apis:jar:1.0.b2, javax.transaction:jta:jar:1.1, org.hibernate:hibernate-entitymanager:jar:3.5.1-Final, org.hibernate:hibernate-annotations:jar:3.5.1-Final, org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final, cglib:cglib:jar:2.2, asm:asm:jar:3.1, javassist:javassist:jar:3.9.0.GA, org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final, org.springframework:spring-context:jar:3.2.4.RELEASE, org.springframework:spring-aop:jar:3.2.4.RELEASE, org.springframework:spring-expression:jar:3.2.4.RELEASE, com.existanze.libraries:orm:jar:0.0.3, joda-time:joda-time:jar:1.6.2, com.jolbox:bonecp:jar:0.7.1.RELEASE, com.google.guava:guava:jar:r08: The repository system is offline but the artifact commons-codec:commons-codec:jar:1.5 is not available in the local repository.
I have to say that locally I am not facing any problem with dependencies resolution. What I am developing is a mavenized Spring MVC multi-project in Netbeans.
Now that I am trying to deploy it to the server I receive this error. I tried also mvn clean install -U to update SNAPSHOT but it still does not work. I don't know what else to do, so at this point I need some expert help.
Thank you very much.
I suspect that your Ubuntu server does not allow external internet connection to the central repository. Please change the firewall to allow the central repository access. If this is not allowed due to your corporation security policy, you might have to deploy a enterprise maven repository within your corporation.

Categories