Skip to content

Commit 23bf11e

Browse files
committed
o Removing commons-logging dependency and code.
o Replacing plexus lookup with code. o Making the Zip packaging format log a warning if <symlink> is used.
1 parent c5dbf6a commit 23bf11e

File tree

21 files changed

+86
-359
lines changed

21 files changed

+86
-359
lines changed

unix-core/src/main/java/org/codehaus/mojo/unix/core/UnixPlatform.java

100644100755
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
import org.codehaus.mojo.unix.*;
2828

29-
/**
30-
*/
3129
public interface UnixPlatform
3230
{
3331
FileAttributes getDefaultFileAttributes();

unix-maven-plugin/pom.xml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@
4242
<artifactId>commons-lang</artifactId>
4343
<version>2.1</version>
4444
</dependency>
45-
<dependency>
46-
<groupId>commons-logging</groupId>
47-
<artifactId>commons-logging</artifactId>
48-
<version>1.0.4</version>
49-
</dependency>
5045
<dependency>
5146
<groupId>joda-time</groupId>
5247
<artifactId>joda-time</artifactId>
@@ -56,24 +51,6 @@
5651
<groupId>org.apache.maven</groupId>
5752
<artifactId>maven-core</artifactId>
5853
</dependency>
59-
<!--
60-
<dependency>
61-
<groupId>org.apache.maven</groupId>
62-
<artifactId>maven-artifact</artifactId>
63-
</dependency>
64-
<dependency>
65-
<groupId>org.apache.maven</groupId>
66-
<artifactId>maven-project</artifactId>
67-
</dependency>
68-
<dependency>
69-
<groupId>org.apache.maven</groupId>
70-
<artifactId>maven-plugin-api</artifactId>
71-
</dependency>
72-
<dependency>
73-
<groupId>org.apache.maven</groupId>
74-
<artifactId>maven-model</artifactId>
75-
</dependency>
76-
-->
7754
<dependency>
7855
<groupId>org.codehaus.plexus</groupId>
7956
<artifactId>plexus-container-default</artifactId>
@@ -148,6 +125,28 @@
148125
</filesets>
149126
</configuration>
150127
</plugin>
128+
<plugin>
129+
<groupId>org.apache.maven.plugins</groupId>
130+
<artifactId>maven-enforcer-plugin</artifactId>
131+
<executions>
132+
<execution>
133+
<goals>
134+
<goal>enforce</goal>
135+
</goals>
136+
</execution>
137+
</executions>
138+
<configuration>
139+
<rules>
140+
<bannedDependencies>
141+
<excludes>
142+
<exclude>log4j</exclude>
143+
<exclude>commons-logging</exclude>
144+
</excludes>
145+
</bannedDependencies>
146+
</rules>
147+
<fail>true</fail>
148+
</configuration>
149+
</plugin>
151150
</plugins>
152151
</build>
153152
<profiles>

unix-maven-plugin/src/it/test-zip-1/pom4test.xml

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@
6868
<mode>0666</mode>
6969
</attributes>
7070
</copyArtifact>
71+
<symlink>
72+
<path>/var/log/hudson</path>
73+
<value>/var/opt/hudson/log</value>
74+
</symlink>
7175
<filterFiles>
7276
<includes>
7377
<include>/opt/hudson/etc/*</include>

unix-maven-plugin/src/main/java/org/codehaus/mojo/unix/maven/MojoHelper.java

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import fj.data.Set;
3838
import static fj.data.Set.*;
3939
import static java.lang.String.*;
40-
import org.apache.commons.logging.*;
4140
import org.apache.maven.artifact.*;
4241
import org.apache.maven.plugin.*;
4342
import org.apache.maven.plugin.logging.Log;
@@ -48,7 +47,6 @@
4847
import org.codehaus.mojo.unix.io.fs.*;
4948
import org.codehaus.mojo.unix.java.*;
5049
import static org.codehaus.mojo.unix.java.StringF.*;
51-
import org.codehaus.mojo.unix.maven.logging.*;
5250
import org.codehaus.mojo.unix.maven.plugin.*;
5351
import org.codehaus.mojo.unix.maven.plugin.Package;
5452
import static org.codehaus.mojo.unix.util.FileModulator.*;
@@ -74,7 +72,6 @@ public abstract class MojoHelper
7472
public static <UP extends UnixPackage<UP, PP>, PP extends UnixPackage.PreparedPackage> Execution create(
7573
Map platforms,
7674
String platformType,
77-
Map formats,
7875
String formatType,
7976
MavenProjectWrapper project,
8077
boolean debug,
@@ -84,9 +81,7 @@ public static <UP extends UnixPackage<UP, PP>, PP extends UnixPackage.PreparedPa
8481
final Log log )
8582
throws MojoFailureException, MojoExecutionException
8683
{
87-
MavenCommonLoggingLogFactory.setMavenLogger( log );
88-
89-
@SuppressWarnings( "unchecked" ) PackagingFormat<UP> format = (PackagingFormat<UP>) formats.get( formatType );
84+
PackagingFormat<UP> format = PackagingFormat.lookup( formatType );
9085

9186
if ( format == null )
9287
{
@@ -133,7 +128,7 @@ public static <UP extends UnixPackage<UP, PP>, PP extends UnixPackage.PreparedPa
133128
mojoParameters,
134129
pakke );
135130

136-
UP unixPackage = format.start().
131+
UP unixPackage = format.start( log ).
137132
parameters( parameters ).
138133
setVersion( version ). // TODO: This should go away
139134
workingDirectory( packageRoot ).
@@ -240,29 +235,6 @@ public Execution( List<P3<UP, Package, List<AssemblyOperation>>> packages, Maven
240235

241236
public void execute( String artifactType, MavenProject mavenProject, MavenProjectHelper mavenProjectHelper, ScriptUtil.Strategy strategy )
242237
throws MojoExecutionException, MojoFailureException
243-
{
244-
// Save and restore the system property for commons logging.
245-
String key = LogFactory.class.getName();
246-
String value = System.getProperty( key );
247-
248-
System.setProperty( key, MavenCommonLoggingLogFactory.class.getName() );
249-
250-
try
251-
{
252-
execute_( artifactType, mavenProject, mavenProjectHelper, strategy );
253-
}
254-
finally {
255-
if(value == null) {
256-
System.getProperties().remove( key );
257-
}
258-
else {
259-
System.setProperty( key, value );
260-
}
261-
}
262-
}
263-
264-
private void execute_( String artifactType, MavenProject mavenProject, MavenProjectHelper mavenProjectHelper, ScriptUtil.Strategy strategy )
265-
throws MojoExecutionException, MojoFailureException
266238
{
267239
for ( P3<UP, Package, List<AssemblyOperation>> p : packages )
268240
{

unix-maven-plugin/src/main/java/org/codehaus/mojo/unix/maven/deb/DebPackagingFormat.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,17 @@
2424
* SOFTWARE.
2525
*/
2626

27+
import org.apache.maven.plugin.logging.*;
2728
import org.codehaus.mojo.unix.maven.plugin.*;
2829

2930
/**
3031
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
3132
*/
3233
public class DebPackagingFormat
33-
implements PackagingFormat<DebUnixPackage>
34+
extends PackagingFormat<DebUnixPackage>
3435
{
35-
public DebUnixPackage start()
36+
public DebUnixPackage start(Log log)
3637
{
3738
return new DebUnixPackage();
3839
}
39-
40-
public boolean licenseRequired()
41-
{
42-
return false;
43-
}
4440
}

unix-maven-plugin/src/main/java/org/codehaus/mojo/unix/maven/logging/CommonsLogAdapter.java

Lines changed: 0 additions & 128 deletions
This file was deleted.

unix-maven-plugin/src/main/java/org/codehaus/mojo/unix/maven/logging/MavenCommonLoggingLogFactory.java

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)