mirror of https://github.com/apache/maven.git
o removal of xstream and bits of cruft
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163213 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e48ea54902
commit
4487d95d95
|
@ -17,11 +17,6 @@
|
||||||
<artifactId>qdox</artifactId>
|
<artifactId>qdox</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>xstream</groupId>
|
|
||||||
<artifactId>xstream</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>modello</groupId>
|
<groupId>modello</groupId>
|
||||||
<artifactId>modello</artifactId>
|
<artifactId>modello</artifactId>
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
package org.apache.maven.plugin;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapt a maven2 plugin for use as a bean with setters that can be used
|
|
||||||
* within Jelly and Ant.
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class BeanPluginAdapter
|
|
||||||
{
|
|
||||||
private Map parameters;
|
|
||||||
|
|
||||||
private Plugin plugin;
|
|
||||||
|
|
||||||
public BeanPluginAdapter( Plugin plugin )
|
|
||||||
{
|
|
||||||
this.plugin = plugin;
|
|
||||||
|
|
||||||
parameters = new HashMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
public void execute()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
PluginExecutionRequest request = new PluginExecutionRequest( parameters );
|
|
||||||
|
|
||||||
PluginExecutionResponse response = new PluginExecutionResponse();
|
|
||||||
|
|
||||||
plugin.execute( request, response );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected void addParameter( String key, Object value )
|
|
||||||
{
|
|
||||||
parameters.put( key, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Plugin getPlugin()
|
|
||||||
{
|
|
||||||
return plugin;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,8 +16,6 @@ package org.apache.maven.plugin.descriptor;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.plugin.descriptor.Parameter;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.maven.plugin.descriptor;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
package org.apache.maven.plugin.descriptor;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import com.thoughtworks.xstream.XStream;
|
|
||||||
import com.thoughtworks.xstream.alias.DefaultClassMapper;
|
|
||||||
import com.thoughtworks.xstream.alias.DefaultNameMapper;
|
|
||||||
import com.thoughtworks.xstream.objecttree.reflection.JavaReflectionObjectFactory;
|
|
||||||
import com.thoughtworks.xstream.xml.xpp3.Xpp3DomBuilder;
|
|
||||||
import com.thoughtworks.xstream.xml.xpp3.Xpp3DomXMLReader;
|
|
||||||
import com.thoughtworks.xstream.xml.xpp3.Xpp3DomXMLReaderDriver;
|
|
||||||
|
|
||||||
import java.io.Reader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PluginDescriptorBuilder
|
|
||||||
{
|
|
||||||
private XStream xstream;
|
|
||||||
|
|
||||||
public PluginDescriptorBuilder()
|
|
||||||
{
|
|
||||||
xstream = new XStream( new JavaReflectionObjectFactory(),
|
|
||||||
new DefaultClassMapper( new DefaultNameMapper() ),
|
|
||||||
new Xpp3DomXMLReaderDriver(),
|
|
||||||
"implementation" );
|
|
||||||
|
|
||||||
xstream.alias( "plugin", PluginDescriptor.class );
|
|
||||||
|
|
||||||
xstream.alias( "mojo", MojoDescriptor.class );
|
|
||||||
|
|
||||||
xstream.alias( "prereq", String.class );
|
|
||||||
|
|
||||||
xstream.alias( "parameter", Parameter.class );
|
|
||||||
|
|
||||||
xstream.alias( "dependency", Dependency.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
public PluginDescriptor build( Reader reader )
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
return (PluginDescriptor) xstream.fromXML( new Xpp3DomXMLReader( Xpp3DomBuilder.build( reader ) ) );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
package org.apache.maven.plugin;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class Bean
|
|
||||||
extends BeanPluginAdapter
|
|
||||||
{
|
|
||||||
public Bean()
|
|
||||||
{
|
|
||||||
super( new TestPlugin() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName( String name )
|
|
||||||
{
|
|
||||||
addParameter( "name", name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArtifactId( String artifactId )
|
|
||||||
{
|
|
||||||
addParameter( "artifactId", artifactId );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFoo( String foo )
|
|
||||||
{
|
|
||||||
addParameter( "foo", foo );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasExecuted()
|
|
||||||
{
|
|
||||||
return ((TestPlugin)getPlugin()).hasExecuted();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package org.apache.maven.plugin;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2001-2004 The Apache Software Foundation.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class BeanTest
|
|
||||||
extends TestCase
|
|
||||||
{
|
|
||||||
public void testBean()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
Bean bean = new Bean();
|
|
||||||
|
|
||||||
bean.setName( "jason" );
|
|
||||||
|
|
||||||
bean.setArtifactId( "artifactId" );
|
|
||||||
|
|
||||||
bean.setFoo( "bar" );
|
|
||||||
|
|
||||||
bean.execute();
|
|
||||||
|
|
||||||
assertTrue( bean.hasExecuted() );
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue