Claus Ibsen created FORGE-2178:
----------------------------------
Summary: DependencyInstaller.install - Installs as managed dependency
Key: FORGE-2178
URL:
https://issues.jboss.org/browse/FORGE-2178
Project: Forge
Issue Type: Bug
Affects Versions: 2.12.3.Final
Reporter: Claus Ibsen
Priority: Minor
I am developing a camel addon, and we have a command to enable Camel to a project.
So we use this code
{code}
@Override
public Result execute(UIExecutionContext context) throws Exception {
Project project = getSelectedProject(context);
// does the project already have camel?
Dependency core = findCamelCoreDependency(project);
if (core != null) {
return Results.success("Camel already enabled on project");
}
DependencyBuilder builder =
DependencyBuilder.create().setGroupId("org.apache.camel").setArtifactId("camel-core");
if (version.getValue() != null) {
builder.setVersion(version.getValue());
}
core = builder;
// add camel-core
dependencyInstaller.install(project, core);
return Results.success("Added camel-core to project");
}
{code}
Notice we use
{code}
dependencyInstaller.install(project, core);
{code}
Which according to javadoc installs the dependency as non-managed. As there is a
installManaged method for that.
But the pom.xml gets generated as managed,
{code}
[mydemo]$ more pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.mydemo</groupId>
<artifactId>mydemo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.14.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
</dependencies>
<build>
<finalName>mydemo</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
{code}
Notice the dependencyManagement section in the pom.xml.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)