| Author |
Message |
|
|
Post subject: Invoke goals on resource changes
Posted: Jun 16, 2011 - 02:27 PM
|
|
Joined: Jul 21, 2009
Posts: 15
|
|
I have a web application which is basically an empty container runtime. and the application is made up from plugins (jar files).
a jar file/plugin. contains java classes, web resources (facelet fragments) and config files (faces and spring).
the plugin container monitors a hot deploy folder, because every plugin has its own seperate spring context and runs in isolatiomn, plugins can be replaced at runtime, a server or application restart is not necesary.
i attached an ant-task to the install phase:
| Code: |
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<copy todir="${plugin.deploy.location}"
file="target/${project.artifactId}-${project.version}.jar"
failonerror="false">
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<version>1.6</version>
</plugin>
|
now, eveytime a developer changes a plugin, he/she needs to run install and the plugin gets deployed to the watch folder. But this is a slight pain in the rear because its repetitive work so i am on a mission to automate this process.
I figured two solutions for this.
invoke "install" on resource changes:
this is a project setting under Lifecycle mapping. it executes "install" everytime you safe a resource ( i actually configured the src/main/java folder to be a resource folder too, excluding all **/*.java files so that it also executes "install" when a java file is saved). So far so good, the trigger mechanism works fine, but the execution fails:
| Code: |
16/06/11 13:46:45 BST: Build errors for WebMenuPlugin; org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-install-plugin:2.3 or one of its dependencies could not be resolved: The repository system is offline and the requested artifact is not locally available at C:\Users\XXXXXX\.m2\repository\org\apache\maven\plugins\maven-install-plugin] -->.3\maven-install-plugin-2.3.jar
org.apache.maven.plugins:maven-install-plugin:maven-plugin:2.3
from the specified remote repositories:
archiva.park.web (http://XXXX:8080/archiva/repository/parkweb, releases=true, snapshots=false)
|
why is it saying the repository system is offline? is there a "offline" switch somewhere?
solution B, adding a maven builder:
I added a maven builder to my project, set "Auto Build Goals" to "install". But when the builder is active and i save a resource, it either tells me that "install" is not a valid phase, but also lists install as a valid phase...?!?! or, it shows
| Code: |
16/06/11 14:19:36 BST: Build errors for WebMenuPlugin; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.4.1:resources (default-resources) on project web-menu-plugin: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.1:resources failed: Unable to load the mojo 'resources' in the plugin 'org.apache.maven.plugins:maven-resources-plugin:2.4.1'. A required class is missing: org/apache/maven/shared/filtering/MavenFilteringException
|
has anyone an idea why this would fail? or maybe a there is a better way to do this auto-deploy/install thing?
we use apache archiva internally, but the errors are the same if i use the maven repository directly. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jun 17, 2011 - 10:46 AM
|
|
Joined: Jul 21, 2009
Posts: 15
|
|
any Maven Builder i set up compains that there is no goal to run.
| Code: | | [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1] |
but there is. this is my launch configuration:
| Code: | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.maven.ide.eclipse.Maven2BuilderConfigurationType">
<booleanAttribute key="M2_DEBUG_OUTPUT" value="true"/>
<stringAttribute key="M2_GOALS_AFTER_CLEAN" value=""/>
<stringAttribute key="M2_GOALS_AUTO_BUILD" value="install"/>
<stringAttribute key="M2_GOALS_CLEAN" value=""/>
<stringAttribute key="M2_GOALS_MANUAL_BUILD" value=""/>
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
<booleanAttribute key="M2_OFFLINE" value="false"/>
<stringAttribute key="M2_PROFILES" value=""/>
<listAttribute key="M2_PROPERTIES"/>
<stringAttribute key="M2_RUNTIME" value="D:\dev\tools\apache-maven-3.0.3"/>
<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="true"/>
<booleanAttribute key="editedByExternalToolsMainTab" value="true"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_APPEND_TO_FILE" value="true"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/WebMenuPlugin}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,clean"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration> |
|
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jun 18, 2011 - 01:08 PM
|
|

Joined: Apr 14, 2011
Posts: 22
|
|
Please go to the Preferences -> MyEclipse -> Maven4MyEclipse -> Maven and make sure that the offline checkbox is unchecked. Please send me also Your pom.xml |
|
|
| |
|
|
|
 |
|
|
|