You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Yuri Schimke (JIRA)" <ji...@codehaus.org> on 2008/04/25 09:40:46 UTC
[jira] Commented: (MECLIPSE-407) EclipsePlugin parameter to skip
dependency resolution
[ http://jira.codehaus.org/browse/MECLIPSE-407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=132572#action_132572 ]
Yuri Schimke commented on MECLIPSE-407:
---------------------------------------
Because we want PDE dependencies in the Eclipse, we have the above change. However we also want our products to deploy with either
- built JAR files i.e. valid OSGi bundles built by maven
- With project open in Eclipse workspace so we can make code changes etc
To get the second to work, you also need a build.properties file, so we have ended up with the following
public class BaclipsePlugin extends EclipsePlugin {
protected void setupExtras() throws MojoExecutionException {
if (isPdeProject()) {
// disable normal dependency resolution
setResolveDependencies(false);
}
}
protected void writeOsgiManifest(EclipseWriterConfig config) throws MojoExecutionException {
}
protected void writeBuildProperties(EclipseWriterConfig config) throws MojoExecutionException {
File projectRelativeFile = new File(getEclipseProjectDir(), "build.properties");
StringBuilder content = new StringBuilder();
String sourceDirectories = getSourceDirectoriesString(config);
content.append("source.. = " + sourceDirectories + "\n");
String outputDirectories = getOutputDirectoriesString(config);
content.append("output.. = " + outputDirectories + "\n");
String binIncludes = getIncludesString(config);
content.append("bin.includes = " + binIncludes + "\n");
try {
FileUtils.fileWrite(projectRelativeFile.getAbsolutePath(), content.toString());
} catch (IOException e) {
throw new MojoExecutionException(Messages.getString("EclipsePlugin.cantwritetofile", //$NON-NLS-1$
projectRelativeFile.getAbsolutePath()));
}
}
private String getIncludesString(EclipseWriterConfig config) {
return "META-INF/";
}
private String getSourceDirectoriesString(EclipseWriterConfig config) {
StringBuilder string = new StringBuilder();
EclipseSourceDir[] sourceDirs = config.getSourceDirs();
for (int i = 0; i < sourceDirs.length; i++) {
if (i > 0) {
string.append(",");
}
string.append(sourceDirs[i].getPath());
}
return string.toString();
}
private String getOutputDirectoriesString(EclipseWriterConfig config) throws MojoExecutionException {
Set paths = new HashSet();
StringBuilder string = new StringBuilder();
EclipseSourceDir[] sourceDirs = config.getSourceDirs();
for (int i = 0; i < sourceDirs.length; i++) {
String outputDir = sourceDirs[i].getOutput();
if (outputDir == null) {
outputDir =
IdeUtils.toRelativeAndFixSeparator( config.getProjectBaseDir(), config.getBuildOutputDirectory(), false );
}
if (paths.add(outputDir)) {
if (string.length() > 0) {
string.append(",");
}
string.append(outputDir);
}
}
return string.toString();
}
}
> EclipsePlugin parameter to skip dependency resolution
> -----------------------------------------------------
>
> Key: MECLIPSE-407
> URL: http://jira.codehaus.org/browse/MECLIPSE-407
> Project: Maven 2.x Eclipse Plugin
> Issue Type: Improvement
> Components: PDE support
> Affects Versions: 2.5
> Reporter: Yuri Schimke
>
> Because all our projects are PDE projects, we don't need want all the JARs copied locally and added to the classpath.
> Because there is no option to stop them being added to .classpath apart from adding a lot of excludes, we have a subclass of EclipsePlugin that does a similar tihng to the M2EclipsePlugin
> protected void setupExtras() throws MojoExecutionException {
> if (isPdeProject()) {
> // disable normal dependency resolution
> setResolveDependencies(false);
> }
> }
> However, it we could set a flag to stop dependency resolution, we would not need to maintain our own plugin. i.e. add the parameter javadoc.
> /**
> * Flag for mojo implementations to control whether normal maven dependencies should be resolved. Default value is
> * true.
> *
> * @parameter expression="${eclipse.resolveDependencies}" default-value="true"
> */
> private boolean resolveDependencies = true;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira