如果要运行在其[{
hours: '11:00 to 12:00',
quantity: 1
},
{
hours: '12:00 to 13:00',
quantity: 1
},
{
hours: '13:00 to 14:00',
quantity: 2
}]
批注中具有requiresDependencyResolution = ResolutionScope.COMPILE
的Maven目标,即要求在运行之前解决所有依赖关系,则在多模块项目中会遇到问题。 / p>
如果一个模块引用另一个模块,则该另一个模块不存在(当您在父或子上使用@Mojo
启动目标时),并且解析失败。
在多模块项目的上下文中如何使用这样的Maven插件?
答案 0 :(得分:0)
诀窍是尽可能使用with Glib; use Glib;
with Gtk.Main;
with Gtk.Widget;
with Gtk.Window;
with Gtk.Enums;
with Gtk.Adjustment;
with Cairo;
package body Demo.Main_Window is
procedure Destroy_Event_Callback
(Widget : access Gtk.Widget.Gtk_Widget_Record'Class);
function Draw_Event_Callback
(Self : access Gtk.Widget.Gtk_Widget_Record'Class;
Cr : Cairo.Cairo_Context) return Boolean;
-------------
-- Gtk_New --
-------------
procedure Gtk_New (Main_Window : out Demo_Main_Window) is
begin
Main_Window := new Demo_Main_Window_Record;
Demo.Main_Window.Initialize (Main_Window);
end Gtk_New;
----------------
-- Initialize --
----------------
procedure Initialize
(Main_Window : not null access Demo_Main_Window_Record'Class)
is
begin
Gtk.Window.Initialize (Main_Window);
-- Setup window
Main_Window.Set_Title ("Demo");
Main_Window.Set_Size_Request (Window_Width, Window_Height);
Main_Window.Set_Resizable (False);
Main_Window.On_Destroy (Destroy_Event_Callback'Access);
-- Add controls
Gtk_New (Main_Window.SW);
Gtk_New_Vbox (Main_Window.VB);
Gtk_New (Main_Window.DA);
Main_Window.SW.Set_Policy
(Hscrollbar_Policy => Gtk.Enums.Policy_Always,
Vscrollbar_Policy => Gtk.Enums.Policy_Always);
Main_Window.DA.Set_Size_Request (Draw_Area_Width, Draw_Area_Height);
Main_Window.DA.On_Draw (Draw_Event_Callback'Access);
Main_Window.VB.Pack_Start (Main_Window.DA, True, True, 0);
Main_Window.SW.Add (Main_Window.VB);
Main_Window.Add (Main_Window.SW);
-- Show the window.
Main_Window.Show_All;
end Initialize;
----------------------------
-- Destroy_Event_Callback --
----------------------------
procedure Destroy_Event_Callback
(Widget : access Gtk.Widget.Gtk_Widget_Record'Class)
is
begin
Gtk.Main.Main_Quit;
end Destroy_Event_Callback;
-------------------------
-- Draw_Event_Callback --
-------------------------
function Draw_Event_Callback
(Self : access Gtk.Widget.Gtk_Widget_Record'Class;
Cr : Cairo.Cairo_Context) return Boolean
is
-- Draw some rectangles. This function is not optimal in terms of
-- performance as everything is being redrawn, including the non
-- visible parts, but it's OK (I think) for the demo.
Num_X : constant Gint := 20;
Num_Y : constant Gint := 20;
Ratio : constant Gdouble := 0.8;
Dx : constant GDouble := GDouble (Self.Get_Allocated_Width / Num_X);
Dy : constant GDouble := GDouble (Self.Get_Allocated_Height / Num_Y);
-- Or, alternatively (same outcome)
-- Dx : constant GDouble := GDouble (Draw_Area_Width / Num_X);
-- Dy : constant GDouble := GDouble (Draw_Area_Height / Num_Y);
begin
for X in 0 .. Num_X - 1 loop
for Y in 0 .. Num_Y - 1 loop
Cairo.Set_Source_RGB
(Cr => Cr,
Red => GDouble (X) / GDouble (Num_X),
Green => GDouble (X * Y) / GDouble (Num_X * Num_Y),
Blue => GDouble (Y) / GDouble (Num_Y));
Cairo.Rectangle
(Cr => Cr,
X => Dx * (GDouble (X) + 0.5 * (1.0 - Ratio)),
Y => Dy * (GDouble (Y) + 0.5 * (1.0 - Ratio)),
Width => Dx * Ratio,
Height => Dy * Ratio);
Cairo.Fill (Cr);
end loop;
end loop;
return True; -- GDK_EVENT_STOP, do not propagate event to parent.
end Draw_Event_Callback;
end Demo.Main_Window;
,因为它不需要构建其他模块。