Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[MTOMCAT-215] Multiple manifests under META-INF, two Main-Class entries

Submitted by Tim Astle.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/maven-plugin/trunk@1460305 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 81757c3c14079231a15d6b849a7f92697214fb51 1 parent 8868757
Olivier Lamy authored March 24, 2013
48  tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
@@ -69,45 +69,45 @@
69 69
     extends AbstractTomcat7Mojo
70 70
 {
71 71
 
72  
-    @Parameter( defaultValue = "${project.artifact}", required = true, readonly = true )
  72
+    @Parameter(defaultValue = "${project.artifact}", required = true, readonly = true)
73 73
     protected Artifact projectArtifact;
74 74
 
75 75
     /**
76 76
      * The maven project.
77 77
      */
78  
-    @Parameter( defaultValue = "${project}", required = true, readonly = true )
  78
+    @Parameter(defaultValue = "${project}", required = true, readonly = true)
79 79
     protected MavenProject project;
80 80
 
81  
-    @Parameter( defaultValue = "${plugin.artifacts}", required = true )
  81
+    @Parameter(defaultValue = "${plugin.artifacts}", required = true)
82 82
     protected List<Artifact> pluginArtifacts;
83 83
 
84  
-    @Parameter( defaultValue = "${project.build.directory}" )
  84
+    @Parameter(defaultValue = "${project.build.directory}")
85 85
     protected File buildDirectory;
86 86
 
87 87
     /**
88 88
      * Path under {@link #buildDirectory} where this mojo may do temporary work.
89 89
      */
90  
-    @Parameter( defaultValue = "${project.build.directory}/tomcat7-maven-plugin-exec" )
  90
+    @Parameter(defaultValue = "${project.build.directory}/tomcat7-maven-plugin-exec")
91 91
     private File pluginWorkDirectory;
92 92
 
93  
-    @Parameter( property = "maven.tomcat.exec.war.tomcatConf", defaultValue = "src/main/tomcatconf" )
  93
+    @Parameter(property = "maven.tomcat.exec.war.tomcatConf", defaultValue = "src/main/tomcatconf")
94 94
     protected File tomcatConfigurationFilesDirectory;
95 95
 
96  
-    @Parameter( defaultValue = "src/main/tomcatconf/server.xml", property = "maven.tomcat.exec.war.serverXml" )
  96
+    @Parameter(defaultValue = "src/main/tomcatconf/server.xml", property = "maven.tomcat.exec.war.serverXml")
97 97
     protected File serverXml;
98 98
 
99 99
     /**
100 100
      * Name of the generated exec JAR.
101 101
      */
102  
-    @Parameter( property = "tomcat.jar.finalName",
103  
-                defaultValue = "${project.artifactId}-${project.version}-war-exec.jar", required = true )
  102
+    @Parameter(property = "tomcat.jar.finalName",
  103
+               defaultValue = "${project.artifactId}-${project.version}-war-exec.jar", required = true)
104 104
     protected String finalName;
105 105
 
106 106
     /**
107 107
      * The webapp context path to use for the web application being run.
108 108
      * The name to store webapp in exec jar. Do not use /
109 109
      */
110  
-    @Parameter( property = "maven.tomcat.path", defaultValue = "${project.artifactId}", required = true )
  110
+    @Parameter(property = "maven.tomcat.path", defaultValue = "${project.artifactId}", required = true)
111 111
     protected String path;
112 112
 
113 113
     @Parameter
@@ -125,13 +125,13 @@
125 125
     /**
126 126
      * Location of the local repository.
127 127
      */
128  
-    @Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
  128
+    @Parameter(defaultValue = "${localRepository}", required = true, readonly = true)
129 129
     protected ArtifactRepository local;
130 130
 
131 131
     /**
132 132
      * List of Remote Repositories used by the resolver
133 133
      */
134  
-    @Parameter( defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true )
  134
+    @Parameter(defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true)
135 135
     protected List<ArtifactRepository> remoteRepos;
136 136
 
137 137
     @Component
@@ -140,35 +140,35 @@
140 140
     /**
141 141
      * Attach or not the generated artifact to the build (use true if you want to install or deploy it)
142 142
      */
143  
-    @Parameter( property = "maven.tomcat.exec.war.attachArtifact", defaultValue = "true", required = true )
  143
+    @Parameter(property = "maven.tomcat.exec.war.attachArtifact", defaultValue = "true", required = true)
144 144
     protected boolean attachArtifact;
145 145
 
146 146
 
147 147
     /**
148 148
      * the classifier to use for the attached/generated artifact
149 149
      */
150  
-    @Parameter( property = "maven.tomcat.exec.war.attachArtifactClassifier", defaultValue = "exec-war",
151  
-                required = true )
  150
+    @Parameter(property = "maven.tomcat.exec.war.attachArtifactClassifier", defaultValue = "exec-war",
  151
+               required = true)
152 152
     protected String attachArtifactClassifier;
153 153
 
154 154
 
155 155
     /**
156 156
      * the type to use for the attached/generated artifact
157 157
      */
158  
-    @Parameter( property = "maven.tomcat.exec.war.attachArtifactType", defaultValue = "jar", required = true )
  158
+    @Parameter(property = "maven.tomcat.exec.war.attachArtifactType", defaultValue = "jar", required = true)
159 159
     protected String attachArtifactClassifierType;
160 160
 
161 161
     /**
162 162
      * to enable naming when starting tomcat
163 163
      */
164  
-    @Parameter( property = "maven.tomcat.exec.war.enableNaming", defaultValue = "false", required = true )
  164
+    @Parameter(property = "maven.tomcat.exec.war.enableNaming", defaultValue = "false", required = true)
165 165
     protected boolean enableNaming;
166 166
 
167 167
     /**
168 168
      * see http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
169 169
      */
170  
-    @Parameter( property = "maven.tomcat.exec.war.accessLogValveFormat", defaultValue = "%h %l %u %t %r %s %b %I %D",
171  
-                required = true )
  170
+    @Parameter(property = "maven.tomcat.exec.war.accessLogValveFormat", defaultValue = "%h %l %u %t %r %s %b %I %D",
  171
+               required = true)
172 172
     protected String accessLogValveFormat;
173 173
 
174 174
     /**
@@ -187,14 +187,14 @@
187 187
     /**
188 188
      * Main class to use for starting the standalone jar.
189 189
      */
190  
-    @Parameter( property = "maven.tomcat.exec.war.mainClass",
191  
-                defaultValue = "org.apache.tomcat.maven.runner.Tomcat7RunnerCli", required = true )
  190
+    @Parameter(property = "maven.tomcat.exec.war.mainClass",
  191
+               defaultValue = "org.apache.tomcat.maven.runner.Tomcat7RunnerCli", required = true)
192 192
     protected String mainClass;
193 193
 
194 194
     /**
195 195
      * which connector protocol to use HTTP/1.1 or org.apache.coyote.http11.Http11NioProtocol
196 196
      */
197  
-    @Parameter( property = "maven.tomcat.exec.war.connectorHttpProtocol", defaultValue = "HTTP/1.1", required = true )
  197
+    @Parameter(property = "maven.tomcat.exec.war.connectorHttpProtocol", defaultValue = "HTTP/1.1", required = true)
198 198
     protected String connectorHttpProtocol;
199 199
 
200 200
     public void execute()
@@ -557,6 +557,10 @@ protected void extractJarToArchive( JarFile file, ArchiveOutputStream os )
557 557
         while ( entries.hasMoreElements() )
558 558
         {
559 559
             JarEntry j = entries.nextElement();
  560
+            if ( StringUtils.equalsIgnoreCase( j.getName(), "META-INF/MANIFEST.MF" ) )
  561
+            {
  562
+                continue;
  563
+            }
560 564
             os.putArchiveEntry( new JarArchiveEntry( j.getName() ) );
561 565
             IOUtils.copy( file.getInputStream( j ), os );
562 566
             os.closeArchiveEntry();

0 notes on commit 81757c3

Please sign in to comment.
Something went wrong with that request. Please try again.