Just had a need to quickly find a file eg. the super pom location in maven which was suspected to be in one of the jar files located within Maven's lib director ($MAVEN_HOME/lib).
The following command seems to work for me, it took me some time messing around with commands to get this out, so guess it would be beneficial to put it down here just to keep myself reminded and also hopefully help some others who are googling for the same stuff.
Eg. to find the super pom located in one of the jars within Maven's lib directory we could do
find . -iname '*.jar' | xargs -n 1 jar -tvf | grep -i '**.xml'This would gives us something like
... 1523 Thu Feb 24 12:34:04 EST 2011 META-INF/maven/org.sonatype.aether/aether-api/pom.xml 3908 Mon Feb 28 18:28:26 EST 2011 META-INF/maven/org.apache.maven/maven-embedder/pom.xml 2222 Mon Feb 28 18:27:48 EST 2011 META-INF/maven/org.apache.maven/maven-settings-builder/pom.xml ... 1931 Mon Feb 28 18:28:12 EST 2011 META-INF/maven/org.apache.maven/maven-repository-metadata/pom.xml 2248 Mon Feb 28 18:27:52 EST 2011 META-INF/maven/org.apache.maven/maven-model-builder/pom.xml ...But it doesn't tell us which jar file it's in. The simplest way I found was to
find . -iname '*.jar' | xargs --verbose -n 1 jar -tvf | grep -i '**.xml'
jar -tvf ./aether-api-1.11.jar 1523 Thu Feb 24 12:34:04 EST 2011 META-INF/maven/org.sonatype.aether/aether-api/pom.xml jar -tvf ./maven-embedder-3.0.3.jar 3908 Mon Feb 28 18:28:26 EST 2011 META-INF/maven/org.apache.maven/maven-embedder/pom.xml jar -tvf ./maven-settings-builder-3.0.3.jar .... jar -tvf ./maven-model-builder-3.0.3.jar 13206 Mon Feb 28 18:30:32 EST 2011 META-INF/plexus/components.xml 4840 Mon Feb 28 18:30:30 EST 2011 org/apache/maven/model/pom-4.0.0.xml 2248 Mon Feb 28 18:27:52 EST 2011 META-INF/maven/org.apache.maven/maven-model-builder/pom.xml ...Now we could tell Maven's super pom,
pom-4.0.0.xml
, is in maven-model-builder-3.0.3.jar
file under /org/apache/maven/modem/
directory.
No comments:
Post a Comment