We have the next project structure:
parentPom.xml
java projects
streambase projects
streambaseParentPom.xml
project1
project2 (has dependency of project1)
So we have a parentPom with inherits to streambaseParentPom and last one inherit to all streambase projects.
So, we make attemp to have in parentPom a properti called cerebro.version which define the version for parent.
We're getting issues when we have project1 as dependency of other projects, we're getting next error message:
[ERROR] Failed to execute goal on project eFX-SB7-Pricing: Could not resolve dependencies for project com.santander.fx:eFX-SB7-Pricing:jar:3.14.10.0.4-SNAPSHOT:
Failed to collect dependencies at com.santander.fx:eFX-SB7-Common:jar:3.14.10.0.4-SNAPSHOT:
Failed to read artifact descriptor for com.santander.fx:eFX-SB7-Common:jar:3.14.10.0.4-SNAPSHOT:
Could not transfer artifact com.santander.fx:eFX-SB7-Parent:pom:${cerebro.version} from/to eFX-External-Repository (http://lnx-efxbuild2.ants.ad.anplc.co.uk:8081/artifactory/ext-release-local):
Illegal character in path at index 109: http://lnx-efxbuild2.ants.ad.anplc.co.uk:8081/artifactory/ext-release-local/com/santander/fx/eFX-SB7-Parent/${cerebro.version}/eFX-SB7-Parent-${cerebro.version}.pom -> [Help 1]
Thanks in advance.
I am afraid it doesn't work like that. It is a bad idea to parameterize the <version> value since even if you managed to deploy it to your remote repo, any project using that artifact later on wouldn't have a clue what ${cerebro.version} should resolve to.
Remember, Maven works hard to keep your builds reproducible. If the build is dependent on some variable that was known at deploy time, but unknown for dependents, your build will no longer be reproducible.
Related
I have a parent POM that, I have used in my other project for dependency management. When I build my child project at that time, it will check in my repository to get parent pom. But at the same time is going to check for the maven central as well. But for obvious from there it is not found and with the exception, my build process is going to stop.
Can anyone tell me the reason why it is happening? Any help is appreciated.
For better understanding, I have attached a log.
[INFO] Downloading from bom-ci-maven: http://xxx:8800/api/v4/projects/xxx/packages/maven/com/xxx/project-bom/0.0.2-DEV/project-bom-0.0.2-DEV.pom
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/com/xxx/project-bom/0.0.2-DEV/project-bom-0.0.2-DEV.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.xxx:xxx:0.0.2-SNAPSHOT: Could not find artifact com.xxx:project-bom:pom:0.0.2-DEV in bom-ci-maven (http://xxx:8880/api/v4/projects/xxx/packages/maven) and 'parent.relativePath' points at wrong local POM # line 4, column 11
#
There are 2 ways to build a module separately from the rest of the modules, including parent.
The best way is to run this from the root directory of your project (note -am):
mvn package -pl child -am
Another option is more cumbersome, but may work faster if your module depends on multiple neighboring modules. First install all the dependencies into local repository. In case of snapshot dependencies it will cache it for some time and then will start checking remote Maven repositories again. This allows you to step into the child module and invoke commands relying on parent or other modules.
Additionally in case of <parent> you can specify a tag <relativePath>, but this one isn't recommended.
I'm attempting to build two Maven projects from Eclipse. One project constitutes a set of dependencies and libraries to be used for the other project which contains all of my source code. Both are configured as Maven projects using Tycho 1.0.0 .
I have a parent POM file that contains three modules: a folder containing my target file, the plugin containing the dependencies and the plugin that contains the source code. When trying to maven build on the parent POM, I get the following error:
Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile (default-compile) on project com.ericsson.cd-editor.ui: Execution default-compile of goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile failed: A required class was missing while executing org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile: freemarker/template/Configuration
Gonna post the full error log in pastebin since it's diffcult to read in a Stack Overflow post:
http://pastebin.com/EYnsqvpJ
Here is my parent POM file:
http://pastebin.com/wSAtwspV
I've been told by a colleague of mine that the reason this might be happening is that this dependency might be used by Tycho and cannot be found. The freemarker package is however available in my .m2/repository/.
It's really hard to tell where the error might be.
First, make sure the jar you have in your m2 archive actually contains the class the compiler is looking for.
You could check whether you dependencies are in the central maven repository, instead of making a project containing them.
Does the project that needs all the dependencies state them explicitly, e.g., in feature.xml or Manifest.mf? Otherwise tycho will not load them, even if they are accessible to maven.
Posting the pom.xml files for the modules might be helpful. Hope you'll figure it out :)
When I execute the mvn install inside the project sm-core of Shopizer, I am getting the below error:
[ERROR] Failed to execute goal on project sm-core:
Could not resolve dependencies for project
com.shopizer:sm-core:jar:2.0.3-SNAPSHOT: The following
artifacts could not be resolved: com.shopizer:sm-core-model:
jar:2.0.3-SNAPSHOT, com.shopizer:sm-core-modules:jar:2.0.3-SNAPSHOT:
Failure to find com.shopizer:sm-core-model:jar:2.0.3-SNAPSHOT
in http://maven.springframework.org/snapshot was
cached in the local repository, resolution will not be
reattempted until the update interval of
org.springframework.maven.snapshot has elapsed or updates
are forced -> [Help 1]
How can I solve it?
The Shopizer project is actually a multi-module Maven project. This means that it has a root pom.xml of packaging pom and declares several <modules>.
Those modules, which are Maven project themselves, are typically found as sub-folders under this root folder, which is the case here: there are 4 sub-folders, which are exactly the 4 Maven modules. To compile those sort of projects, you need to invoke Maven from the root project, in this case, shopizer.
You may ask why. In a multi-module Maven project, there is generally inter-dependencies: one module is dependent on another. In this case, the scm-core module that you're trying to build has dependencies on both sm-core-model and sm-core-modules, which are two modules of that project. So when you're building it, Maven will try to look in your local repository those artifacts. The problem is that it won't find them: they have never been built before. Maven won't also find them on a public repository because we're dealing with SNAPSHOT dependencies. The solution is to start the build on the top project: Maven will order correctly the reactor so that when it builds scm-core, both those dependencies will have been built.
Put simply: in a multi-module Maven project, you should practically always invoke Maven commands from the root POM.
To solve your problem, you can check-out the 2.0.3 branch (which is the latest branch) and invoke mvn clean install on the root POM. I did just that successfully.
I have a project which has multiple sub projects (modules). More specifically this is an Eclipse project and has multiple features.
The issue is a feature might not need any changes for a release. For that reason I don't bump up the version number, but another feature in the same project might have changes. Since it is considered bad practise to re-deploy same versions I disabled that option in Nexus.
Now the actual problem occurs when I deploy. So deploying anything that has a new version number works fine, however when deploying old one I was sort of expecting maven to give warning that it already exits in repository and then skip it but turns out Nexus responds:
Return code is: 400, ReasonPhrase:Bad Request.
which then causes maven to fail the entire deployment process. The full error is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project xyz: Failed to deploy artifacts: Could not transfer artifact xyz:target:2.5.8.0 from/to nexus (http://host/nexus/content/repositories/releases): Failed to transfer file: http://host/nexus/content/repositories/releases/x/targets/xyz/2.5.8.0/xyz-2.5.8.0.target. Return code is: 400, ReasonPhrase:Bad Request. -> [Help 1]
build 11-Sep-2015 07:09:57 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project abc: Failed to deploy artifacts: Could not transfer artifact foo:abc:jar:2.5.8.0 from/to nexus (http://host/nexus/content/repositories/releases): Failed to transfer file: http://host/nexus/content/repositories/releases/bar/abc/2.5.8.0/abc.ocl-2.5.8.0.jar. Return code is: 400, ReasonPhrase:Bad Request. -> [Help 1]
The question is, how can I handle this failure/exception? All I want is if it is already deployed then skip/ignore deployment of that artifact.
See Maven: The Complete Reference, 6.1. Maven Command Line Options, 6.1.8. Dealing with Failure or mvn --help:
-fae,--fail-at-end Only fail the build afterwards;
allow all non-impacted builds to
continue
It is generally accepted best practice in Maven to use the same version across multi-module projects. I would just switch to that scheme and deploy each module even if it didnt really change internally.
If you dont want to do that, it would be better to break your project up into multiple projects that are built and released separately.
The only hacky workaround you can otherwise do is to set the skip property for the Maven deploy plugin for projects that have already been deployed. You will however have to manually manage that and therefore produce additional overhead and churn on your codebase. See more at https://maven.apache.org/plugins/maven-deploy-plugin/faq.html
I have two Gradle projects, A and B. B is a simple Java application and is consumed by A as a compile project dependency. A is a web application.
Both A and B apply the java plugin, A applies the war plugin as well.
When building A, I get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':war'.
> Configuration with name 'default' not found.
When separately building B I get no errors. When building from root, I get no errors either. The issue shows up only when building A.
I've also tried copying the B.jar to the lib folder of A and setting a dependency:
compile files("lib/B.jar")
The build in this case works fine.
What configurations do I need to include to avoid the error?
It's possible, when one subproject doesn't see another, if settings.gradle file is not on the parent directory for both subprojects and the subprojects in it are included via includeFlat. In this case you can call any task from your parent projects and all subprojects will know about each other, but it'll be unable to build separate subproject.
Any way, you need to show your project structure and build/settings files as well, to find out the problem.