diff --git a/maven-plugins/maven-php-core/src/main/java/org/phpmaven/core/ComponentFactory.java b/maven-plugins/maven-php-core/src/main/java/org/phpmaven/core/ComponentFactory.java index 6bcb1d21..ecf029c1 100644 --- a/maven-plugins/maven-php-core/src/main/java/org/phpmaven/core/ComponentFactory.java +++ b/maven-plugins/maven-php-core/src/main/java/org/phpmaven/core/ComponentFactory.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Set; +import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.DebugConfigurationListener; @@ -49,6 +50,7 @@ import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.sonatype.aether.RepositorySystemSession; /** * The component lookup factory for components that are configured via pom.xml. @@ -117,10 +119,10 @@ public T lookup(Class clazz, Xpp3Dom[] configuration, MavenSession sessio configure( configuration, - session.getCurrentProject(), + session == null ? null : session.getCurrentProject(), result, realm, - session); + session == null ? new MavenSession(null, (RepositorySystemSession) null, new DefaultMavenExecutionRequest(), null) : session); return result; } @@ -148,10 +150,10 @@ public T lookup(Class clazz, String roleHint, Xpp3Dom[] configuration, Ma configure( configuration, - session.getCurrentProject(), + session == null ? null : session.getCurrentProject(), result, realm, - session); + session == null ? new MavenSession(null, (RepositorySystemSession) null, new DefaultMavenExecutionRequest(), null) : session); return result; } @@ -328,6 +330,9 @@ private void populatePluginFields(Object component, PlexusConfiguration configur */ @Override public Xpp3Dom getBuildConfig(final MavenProject project, String groupid, String artifactId) { + if (project == null) { + return null; + } final List plugins = project.getBuildPlugins(); for (final Plugin plugin : plugins) { if (plugin.getGroupId().equals(groupid) @@ -394,10 +399,10 @@ public T[] getServiceImplementations(Class type, for (final T res : result) { configure( config, - session.getCurrentProject(), + session == null ? null : session.getCurrentProject(), res, realm, - session); + session == null ? new MavenSession(null, (RepositorySystemSession) null, new DefaultMavenExecutionRequest(), null) : session); } return result; } diff --git a/maven-plugins/maven-php-dependency/src/main/java/org/phpmaven/dependency/IDependencyConfiguration.java b/maven-plugins/maven-php-dependency/src/main/java/org/phpmaven/dependency/IDependencyConfiguration.java index ef42449e..b5206ffa 100644 --- a/maven-plugins/maven-php-dependency/src/main/java/org/phpmaven/dependency/IDependencyConfiguration.java +++ b/maven-plugins/maven-php-dependency/src/main/java/org/phpmaven/dependency/IDependencyConfiguration.java @@ -100,5 +100,11 @@ public interface IDependencyConfiguration { * @return bootstrap php file. */ File getBootstrapFile(); + + /** + * Returns the default actions of this project + * @return default actions + */ + Iterable getDefaults(); } diff --git a/maven-plugins/maven-php-dependency/src/main/java/org/phpmaven/dependency/impl/DependencyConfiguration.java b/maven-plugins/maven-php-dependency/src/main/java/org/phpmaven/dependency/impl/DependencyConfiguration.java index b8aff84f..1844f494 100644 --- a/maven-plugins/maven-php-dependency/src/main/java/org/phpmaven/dependency/impl/DependencyConfiguration.java +++ b/maven-plugins/maven-php-dependency/src/main/java/org/phpmaven/dependency/impl/DependencyConfiguration.java @@ -22,6 +22,7 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Configuration; +import org.phpmaven.dependency.IAction; import org.phpmaven.dependency.IDependency; import org.phpmaven.dependency.IDependencyConfiguration; @@ -44,6 +45,12 @@ public class DependencyConfiguration implements IDependencyConfiguration { * A bootstrap file for bootstrap dependency actions. */ private File bootstrapFile; + + /** + * The default actions. + */ + @Configuration(name = "defaults", value = "") + private ArrayList defaults = new ArrayList(); /** @@ -59,5 +66,11 @@ public Iterable getDependencies() { public File getBootstrapFile() { return this.bootstrapFile; } + + + @Override + public Iterable getDefaults() { + return this.defaults; + } } diff --git a/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/DependencyHelper.java b/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/DependencyHelper.java new file mode 100644 index 00000000..c0abe162 --- /dev/null +++ b/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/DependencyHelper.java @@ -0,0 +1,156 @@ +/** + * Copyright 2010-2012 by PHP-maven.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.phpmaven.project.impl; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; +import org.apache.maven.artifact.resolver.ArtifactResolutionResult; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.DefaultProjectBuildingRequest; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuilder; +import org.apache.maven.project.ProjectBuildingException; +import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.project.ProjectBuildingResult; +import org.apache.maven.repository.RepositorySystem; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.configuration.PlexusConfigurationException; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.phpmaven.core.IComponentFactory; +import org.phpmaven.dependency.IAction; +import org.phpmaven.dependency.IDependency; +import org.phpmaven.dependency.IDependencyConfiguration; +import org.phpmaven.dependency.IAction.ActionType; +import org.phpmaven.dependency.impl.Classic; +import org.phpmaven.exec.PhpException; + +/** + * Helper to process and calculate the dependency actions on a dependency + * + * @author Martin Eisengardt + * @since 2.0.3 + */ +public class DependencyHelper { + + /** + * Resolves the artifact. + * @param groupId group id + * @param artifactId artifact id + * @param version version + * @param type type + * @param classifier classifier + * @return the resolved artifact + * @throws PhpException thrown on resolve errors + */ + private static Artifact resolveArtifact( + String groupId, String artifactId, String version, String type, String classifier, RepositorySystem reposSystem, + MavenSession session) + throws MojoExecutionException { + final Artifact artifact = reposSystem.createArtifactWithClassifier( + groupId, artifactId, version, type, classifier); + final ArtifactResolutionRequest request = new ArtifactResolutionRequest(); + request.setArtifact(artifact); + request.setLocalRepository(session.getLocalRepository()); + request.setOffline(session.isOffline()); + final Set setRepos = new HashSet( + session.getRequest().getRemoteRepositories()); + setRepos.addAll(session.getCurrentProject().getRemoteArtifactRepositories()); + request.setRemoteRepositories(new ArrayList(setRepos)); + final ArtifactResolutionResult result = reposSystem.resolve(request); + if (!result.isSuccess()) { + throw new MojoExecutionException("dependency resolution failed for " + + groupId + ":" + artifactId + ":" + version); + } + + final Artifact resultArtifact = result.getArtifacts().iterator().next(); + return resultArtifact; + } + + public static Iterable getDependencyActions( + Artifact dep, IDependencyConfiguration depConfig, RepositorySystem reposSystem, MavenSession session, + ProjectBuilder projectBuilder, IComponentFactory factory) throws MojoExecutionException { + final List actions = new ArrayList(); + boolean hasClassic = true; + + // try to find dependency configuration + for (final IDependency depCfg : depConfig.getDependencies()) { + if (depCfg.getGroupId().equals(dep.getGroupId()) && + depCfg.getArtifactId().equals(dep.getArtifactId())) { + hasClassic = false; + for (final IAction action : depCfg.getActions()) { + if (action.getType() == ActionType.ACTION_CLASSIC) { + hasClassic = true; + } else { + actions.add(action); + } + } + break; + } + } + + if (hasClassic) { + // try to resolve project defaults + final Artifact artifact = resolveArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), "pom", null, reposSystem, session); + final File pomFile = artifact.getFile(); + final ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest(session.getProjectBuildingRequest()); + pbr.setProcessPlugins(false); + ProjectBuildingResult pbres; + try { + pbres = projectBuilder.build(pomFile, pbr); + } catch (ProjectBuildingException e) { + throw new MojoExecutionException("Error building project", e); + } + final MavenProject project = pbres.getProject(); + final Xpp3Dom pluginConfig = factory.getBuildConfig(project, "org.phpmaven", "maven-php-dependency"); + if (pluginConfig != null) { + final Xpp3Dom defaultConfig = pluginConfig.getChild("defaults"); + if (defaultConfig != null) { + // filter the other nodes to prevent from broken configs on future versions + while (pluginConfig.getChildCount() > 0) pluginConfig.removeChild(0); + pluginConfig.addChild(defaultConfig); + IDependencyConfiguration defCfg; + try { + defCfg = factory.lookup(IDependencyConfiguration.class, pluginConfig, null); + } catch (ComponentLookupException e) { + throw new MojoExecutionException("error receiving default config", e); + } catch (PlexusConfigurationException e) { + throw new MojoExecutionException("error receiving default config", e); + } + for (final IAction action : defCfg.getDefaults()) { + actions.add(action); + } + hasClassic = false; + } + } + + // if hasClassic is still true we did not find any default config + if (hasClassic) { + actions.add(new Classic()); + } + } + return actions; + } + +} diff --git a/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/PhpProject.java b/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/PhpProject.java index 45c9b143..0504c9ae 100644 --- a/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/PhpProject.java +++ b/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/PhpProject.java @@ -30,6 +30,7 @@ import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; @@ -102,6 +103,12 @@ public class PhpProject implements IPhpProject { */ @Requirement private ProjectBuilder mavenProjectBuilder; + + /** + * the repository system. + */ + @Requirement + private RepositorySystem reposSystem; @Override public void prepareDependencies(final Log log, File targetDir, String sourceScope) @@ -129,45 +136,34 @@ public void prepareDependencies(final Log log, File targetDir, String sourceScop final List packedElements = new ArrayList(); packedElements.add(dep.getFile().getAbsolutePath()); - boolean isClassic = true; - for (final IDependency depCfg : depConfig.getDependencies()) { - if (depCfg.getGroupId().equals(dep.getGroupId()) && - depCfg.getArtifactId().equals(dep.getArtifactId())) { - isClassic = false; - for (final IAction action : depCfg.getActions()) { - switch (action.getType()) { - case ACTION_BOOTSTRAP: - performBootstrap(log, info, dep, bootstrapInfo); - break; - case ACTION_CLASSIC: - isClassic = true; - break; - case ACTION_PEAR: - performPearInstall(log, dep, info); - break; - case ACTION_IGNORE: - // do nothing, isClassic should be false so that it is ignored - log.info(dep.getFile().getAbsolutePath() + " will be ignored"); - break; - case ACTION_INCLUDE: - log.info(dep.getFile().getAbsolutePath() + " will be added on include path"); - break; - case ACTION_EXTRACT: - performExtraction(log, dep, packedElements, - action, info); - break; - case ACTION_EXTRACT_INCLUDE: - performExtractAndInclude(log, dep, - packedElements, action, info); - break; - } - } - } - } - - if (isClassic) { - performClassic(log, targetDir, dep, packedElements, info); - } + for (final IAction action : DependencyHelper.getDependencyActions(dep, depConfig, reposSystem, session, mavenProjectBuilder, factory)) { + switch (action.getType()) { + case ACTION_BOOTSTRAP: + performBootstrap(log, info, dep, bootstrapInfo); + break; + case ACTION_CLASSIC: + performClassic(log, targetDir, dep, packedElements, info); + break; + case ACTION_PEAR: + performPearInstall(log, dep, info); + break; + case ACTION_IGNORE: + // do nothing, isClassic should be false so that it is ignored + log.info(dep.getFile().getAbsolutePath() + " will be ignored"); + break; + case ACTION_INCLUDE: + log.info(dep.getFile().getAbsolutePath() + " will be added on include path"); + break; + case ACTION_EXTRACT: + performExtraction(log, dep, packedElements, + action, info); + break; + case ACTION_EXTRACT_INCLUDE: + performExtractAndInclude(log, dep, + packedElements, action, info); + break; + } + } } } catch (IOException ex) { throw new MojoExecutionException("Failed preparing dependencies", ex); diff --git a/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/ProjectPhpExecution.java b/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/ProjectPhpExecution.java index d3b64c87..b36f8d12 100644 --- a/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/ProjectPhpExecution.java +++ b/maven-plugins/maven-php-project/src/main/java/org/phpmaven/project/impl/ProjectPhpExecution.java @@ -23,10 +23,12 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; @@ -70,6 +72,12 @@ public class ProjectPhpExecution implements IProjectPhpExecution { */ @Requirement private ProjectBuilder mavenProjectBuilder; + + /** + * the repository system. + */ + @Requirement + private RepositorySystem reposSystem; /** * {@inheritDoc} @@ -186,6 +194,8 @@ private IPhpExecutableConfiguration getExecutionConfiguration( this.addIncludes(execConfig, buildConfig, mojoConfig, project, mavenSession, depConfig); } catch (ExpressionEvaluationException ex) { throw new PlexusConfigurationException("Problems evaluating the includes", ex); + } catch (MojoExecutionException ex) { + throw new PlexusConfigurationException("Problems evaluating the includes", ex); } return execConfig; } @@ -226,6 +236,8 @@ IPhpExecutableConfiguration getTestExecutionConfiguration( this.addTestIncludes(execConfig, buildConfig, mojoConfig, project, mavenSession, depConfig); } catch (ExpressionEvaluationException ex) { throw new PlexusConfigurationException("Problems evaluating the includes", ex); + } catch (MojoExecutionException ex) { + throw new PlexusConfigurationException("Problems evaluating the includes", ex); } return execConfig; } @@ -246,7 +258,7 @@ private void addIncludes( MavenProject project, MavenSession mavenSession, IDependencyConfiguration depConfig) - throws ExpressionEvaluationException { + throws ExpressionEvaluationException, MojoExecutionException { execConfig.getIncludePath().add(project.getBuild().getOutputDirectory()); File depsDir; if (buildConfig == null || buildConfig.getChild("dependenciesDir") == null) { @@ -290,22 +302,11 @@ private void addFromDepConfig( MavenProject project, String targetScope, IDependencyConfiguration depConfig, - File depsDir) throws ExpressionEvaluationException { + File depsDir) throws ExpressionEvaluationException, MojoExecutionException { final Set deps = project.getArtifacts(); - for (final IDependency dep : depConfig.getDependencies()) { - Artifact depObject = null; - for (final Artifact adep : deps) { - if (!targetScope.equals(adep.getScope())) { - continue; - } - if (adep.getGroupId().equals(dep.getGroupId()) && adep.getArtifactId().equals(dep.getArtifactId())) { - depObject = adep; - break; - } - } - - if (depObject == null) { - // silently ignore + + for (final Artifact depObject : deps) { + if (!targetScope.equals(depObject.getScope())) { continue; } @@ -315,10 +316,11 @@ private void addFromDepConfig( } catch (ProjectBuildingException ex) { throw new ExpressionEvaluationException("Problems creating maven project from dependency", ex); } + if (depProject.getFile() != null) { // Reference to a local project; should only happen in IDEs or multi-project poms - for (final IAction action : dep.getActions()) { + for (final IAction action : DependencyHelper.getDependencyActions(depObject, depConfig, reposSystem, session, mavenProjectBuilder, componentFactory)) { if (action.getType() == ActionType.ACTION_INCLUDE) { final String includePath = getClassesDirFromProject(depProject) + @@ -343,7 +345,7 @@ private void addFromDepConfig( if (depObject.getFile() != null) { // Reference to a local repository - for (final IAction action : dep.getActions()) { + for (final IAction action : DependencyHelper.getDependencyActions(depObject, depConfig, reposSystem, session, mavenProjectBuilder, componentFactory)) { if (action.getType() == ActionType.ACTION_INCLUDE) { final String includePath = ((IActionInclude) action).getPharPath(); execConfig.getIncludePath().add( @@ -365,7 +367,6 @@ private void addFromDepConfig( } } } - } /** @@ -454,7 +455,7 @@ private void addTestIncludes( MavenProject project, MavenSession mavenSession, IDependencyConfiguration depConfig) - throws ExpressionEvaluationException { + throws ExpressionEvaluationException, MojoExecutionException { execConfig.getIncludePath().add(project.getBuild().getTestOutputDirectory()); File depsDir; if (buildConfig == null || buildConfig.getChild("testDependenciesDir") == null) { diff --git a/maven-plugins/maven-php-project/src/test/java/org/phpmaven/project/depmng/test/DefaultsTest.java b/maven-plugins/maven-php-project/src/test/java/org/phpmaven/project/depmng/test/DefaultsTest.java new file mode 100644 index 00000000..256e7e65 --- /dev/null +++ b/maven-plugins/maven-php-project/src/test/java/org/phpmaven/project/depmng/test/DefaultsTest.java @@ -0,0 +1,87 @@ +/** + * Copyright 2010-2012 by PHP-maven.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.phpmaven.project.depmng.test; + +import java.util.List; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.it.Verifier; +import org.phpmaven.core.IComponentFactory; +import org.phpmaven.exec.IPhpExecutableConfiguration; +import org.phpmaven.project.IProjectPhpExecution; +import org.phpmaven.test.AbstractTestCase; + +/** + * test cases for PHP project support with dependency management. + * + * @author Martin Eisengardt + * @since 2.0.0 + */ +public class DefaultsTest extends AbstractTestCase { + + /** + * Tests if the defaults are respected + * + * @throws Exception thrown on errors + */ + public void testDefaults() throws Exception { + // look up the component factory + this.installPhpmavenProjectToRepos("maven-php-plugin"); + this.installPhpParentPom(); + + Verifier verifier = this.getPhpMavenVerifier("project/depmngdef/lib1"); + + verifier.executeGoal("install"); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + verifier.assertArtifactPresent("org.phpmaven.test", "lib1", "0.0.1", "pom"); + verifier.assertArtifactPresent("org.phpmaven.test", "lib1", "0.0.1", "phar"); + + verifier = this.getPhpMavenVerifier("project/depmngdef/proj1"); + + verifier.executeGoal("install"); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + verifier.assertArtifactPresent("org.phpmaven.test", "proj1", "0.0.1", "pom"); + verifier.assertArtifactPresent("org.phpmaven.test", "proj1", "0.0.1", "phar"); + verifier.assertFileNotPresent("target/php-deps/foobar.php"); + final MavenSession session = this.createSessionForPhpMaven( + "project/depmng/proj1", false); + this.resolveProjectDependencies(session); + + final IComponentFactory factory = lookup(IComponentFactory.class); + final IProjectPhpExecution prjConfig = factory.lookup( + IProjectPhpExecution.class, + IComponentFactory.EMPTY_CONFIG, + session); + assertNotNull(prjConfig); + final IPhpExecutableConfiguration config = prjConfig.getExecutionConfiguration(); + assertNotNull(config); + final List includePath = config.getIncludePath(); + boolean found = false; + for (final String path : includePath) { + if (path.startsWith("phar://") && ( + path.endsWith("org/phpmaven/test/lib1/0.0.1/lib1-0.0.1.phar/") || + path.endsWith("org\\phpmaven\\test\\lib1\\0.0.1\\lib1-0.0.1.phar/"))) { + found = true; + break; + } + } + assertTrue(found); + } + +} \ No newline at end of file diff --git a/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/lib1/pom.xml b/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/lib1/pom.xml new file mode 100644 index 00000000..a59f8361 --- /dev/null +++ b/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/lib1/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.phpmaven.test + lib1 + 0.0.1 + + + org.phpmaven + php-parent-pom + 2.0.3-SNAPSHOT + + php + + + + + org.phpmaven + maven-php-dependency + ${phpmaven.plugin.version} + + + + + + + + + \ No newline at end of file diff --git a/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/lib1/src/main/php/foobar.php b/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/lib1/src/main/php/foobar.php new file mode 100644 index 00000000..1b299950 --- /dev/null +++ b/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/lib1/src/main/php/foobar.php @@ -0,0 +1,3 @@ + + + 4.0.0 + + org.phpmaven.test + proj1 + 0.0.1 + + + org.phpmaven + php-parent-pom + 2.0.3-SNAPSHOT + + php + + + + org.phpmaven.test + lib1 + 0.0.1 + phar + + + + + + + org.phpmaven + maven-php-project + ${phpmaven.plugin.version} + + + + + org.phpmaven + maven-php-dependency + ${phpmaven.plugin.version} + + + + + + \ No newline at end of file diff --git a/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/proj1/src/main/php/bar.php b/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/proj1/src/main/php/bar.php new file mode 100644 index 00000000..2995b52d --- /dev/null +++ b/maven-plugins/maven-php-project/src/test/resources/org/phpmaven/test/projects/project/depmngdef/proj1/src/main/php/bar.php @@ -0,0 +1,3 @@ + ... - \ No newline at end of file + + + + + ... + + + org.mycompany + library1 + 0.0.1 + + + + + + org.phpmaven + maven-php-dependency + + + + org.mycompany + library1 + + + /anyfolder + + + + + + + + + ... + + + + + + ... + + + org.mycompany + library1 + 0.0.1 + + + + + + org.phpmaven + maven-php-dependency + + + + + + ... + + + + + + ... + + + + org.phpmaven + maven-php-dependency + + + + /anyfolder + + + + + + + ... + + \ No newline at end of file diff --git a/maven-plugins/src/site/xdoc/index.xml.vm b/maven-plugins/src/site/xdoc/index.xml.vm index 08bbcaea..75d4eb19 100644 --- a/maven-plugins/src/site/xdoc/index.xml.vm +++ b/maven-plugins/src/site/xdoc/index.xml.vm @@ -54,6 +54,7 @@ limitations under the License.
  • new goals for command line: print-include-path and print-test-include-path
  • documentation on exec goal for executing php scripts
  • Trac #78: managing dependencies: bootstrap action.
  • +
  • Trac #78: Setting default actions.
  • diff --git a/maven-plugins/src/site/xdoc/tut-dependencybootstrap.xml.vm b/maven-plugins/src/site/xdoc/tut-dependencybootstrap.xml.vm index e3c63e96..e7bc47a0 100644 --- a/maven-plugins/src/site/xdoc/tut-dependencybootstrap.xml.vm +++ b/maven-plugins/src/site/xdoc/tut-dependencybootstrap.xml.vm @@ -30,7 +30,7 @@ limitations under the License. -

    [ Previous | TOC | Next ]

    +

    [ Previous | TOC | Next ]

    @@ -85,6 +85,6 @@ $mavenDependencies = array( third was already seen by the bootstrap-script. The bootstrap may be invoked for scope 'compile' or 'test'.

    -

    [ Previous | TOC | Next ]

    +

    [ Previous | TOC | Next ]

    \ No newline at end of file diff --git a/maven-plugins/src/site/xdoc/tut-dependencydefaults.xml.vm b/maven-plugins/src/site/xdoc/tut-dependencydefaults.xml.vm new file mode 100644 index 00000000..1b457fff --- /dev/null +++ b/maven-plugins/src/site/xdoc/tut-dependencydefaults.xml.vm @@ -0,0 +1,72 @@ + + + + + + + Maven for PHP - Dependency default actions + Martin Eisengardt + + + + Maven for PHP - Dependency default actions + + + + +

    [ Previous | TOC | Next ]

    + +
    +

    + Dependency actions may be defined from both sides. Let us first visit a sample setup where the phar file has to be put on include path: +

    +

    + org.mycompany:project:0.0.1 depends on org.mycompany:library:0.0.1 and wants to put it on include path. +

    +

    + You may now choose to edit the pom.xml of "org.mycompany:project:0.0.1" and setup an include action: + + + + +

    +

    + Another way is to set a default action. First of all change the pom.xml of "org.mycompany:project:0.0.1" and remove any dependency configuration/ set + it to the classic option: + + + + +

    +

    + Now edit the pom.xml or your library and setup the default action: + + + + +

    + +

    + PHP-Maven will use the default actions of a dependency as a replacement for the classic action. +

    +
    + +

    [ Previous | TOC | Next ]

    + +
    \ No newline at end of file diff --git a/maven-plugins/src/site/xdoc/tutorials.xml.vm b/maven-plugins/src/site/xdoc/tutorials.xml.vm index be5cc09b..ca1b34f3 100644 --- a/maven-plugins/src/site/xdoc/tutorials.xml.vm +++ b/maven-plugins/src/site/xdoc/tutorials.xml.vm @@ -144,7 +144,8 @@ limitations under the License.
  • 3rd party libraries - How to install

    The tutorial will help you to install 3rd party PHP libraries.

  • Multi-Project Layout

    Handling multiple projects and parent poms.

  • Managing dependencies - include path, unpacking and bootstraps

    A way to manage the dependency resolution and let maven help you.

  • -
  • Managing dependencies - deeper inside bootstrap scripts

    Bootstrap scripts to manage the dependencies in details.

  • +
  • Managing dependencies - deeper inside bootstrap scripts

    Bootstrap scripts to manage the dependencies in details.

  • +
  • Setting a default action for dependencies

    Default actions eleminates the need of dependency configurations if a project is used as dependency.

  • Using PEAR projects (upcomming...)

    Integrating dependencies to PEAR projects.

  • Customizing (upcomming...)

    Customizing php-maven/ useful configuration options.