lib/maven/tools/dsl.rb in maven-tools-1.0.0.rc4 vs lib/maven/tools/dsl.rb in maven-tools-1.0.0.rc5
- old
+ new
@@ -144,10 +144,14 @@
@gemspec_args[ 1 ].merge!( options )
gemspec( *@gemspec_args )
end
else
setup_gem_support( options )
+
+ jruby_plugin!( :gem ) do
+ execute_goal :initialize
+ end
end
if pr && pr.dependencies.empty?
@current.profiles.delete( pr )
end
@@ -164,11 +168,11 @@
end
end
if @has_path or @has_git
gem 'bundler', VERSIONS[ :bundler_version ], :scope => :provided unless gem? 'bundler'
- jruby_plugin :gem do
+ jruby_plugin! :gem do
execute_goal :exec, :filename => 'bundle', :args => 'install'
end
end
ensure
@inside_gemfile = nil
@@ -185,15 +189,23 @@
names = deps.select do |d|
sc = d.scope || 'default'
scope.match /#{sc}/
end.collect { |d| d.artifact_id }
locked.dependency_hull( names ).each do |name, version|
- gem name, version, options unless model.artifact_id == name && model.group_id == 'rubygems'
+ gem( name, version, options ) unless has_gem( name )
end
end
private :add_scoped_hull
+ def has_gem( name )
+ ( model.artifact_id == name && model.group_id == 'rubygems' ) ||
+ ( @current.dependencies.detect do |d|
+ d.artifact_id == name && d.group_id == 'rubygems'
+ end != nil )
+ end
+ private :has_gem
+
def setup_gem_support( options, spec = nil, config = {} )
unless model.properties.member?( 'project.build.sourceEncoding' )
properties( 'project.build.sourceEncoding' => 'utf-8' )
end
if spec.nil?
@@ -241,10 +253,13 @@
execute_goals :jar, :phase => 'prepare-package'
end
plugin( :clean, VERSIONS[ :clean_plugin ],
:filesets => [ { :directory => output,
:includes => [ "#{jar}.jar" ] } ] )
+ true
+ else
+ false
end
end
private :setup_gem_support
def setup_jruby( jruby, jruby_scope = :provided )
@@ -360,25 +375,29 @@
authors = [ spec.authors || [] ].flatten
emails = [ spec.email || [] ].flatten
authors.zip( emails ).each do |d|
developer( :name => d[0], :email => d[1] )
end
- unless options[ :only_metadata ]
- packaging 'gem'
+ end
+
+ has_jars = setup_gem_support( options, spec )
+
+ if @context == :project and not options[ :only_metadata ]
+ packaging 'gem'
+ if has_jars
+ extension 'de.saumya.mojo:gem-with-jar-extension:${jruby.plugins.version}'
+ else
extension 'de.saumya.mojo:gem-extension:${jruby.plugins.version}'
end
end
- setup_gem_support( options, spec )
-
return if options[ :only_metadata ]
config = { :gemspec => name.sub( /^#{basedir}\/?/, '' ) }
if options[ :include_jars ] || options[ 'include_jars' ]
config[ :includeDependencies ] = true
end
- plugin( 'de.saumya.mojo:gem-maven-plugin:${jruby.plugins.version}',
- config )
+ jruby_plugin!( :gem, config )
deps = nil
if @inside_gemfile.is_a? Symbol
profile! @inside_gemfile do
deps = all_deps( spec )